#include <iostream> using namespace std; class A { int a; public: A(int x=0):a(x){} void show1() const {cout<<a<<endl;} void show2() {cout<<a<<endl;} }; int main() { A o1(1); const A o2(2); A o3=const_cast<A&>(o2); o1.show1();// 语句1 o2.show2();//语句2 o3.show2();//语句3 o3.show1();//语句4 return 0; }