#include <iostream>
using namespace std;
class Test
{
private:
int x;
const int y;
//************* begin *****************
public:
Test(int a, int b);
void printxy()const; //(1)
} ;
Test::Test(int a, int b):y(b){x=a;} //(2)
void Test::printxy()const //(3)
{
cout<<"x*y="<<x*y<<endl;
}
//************* end *****************
int main()
{
int x1,x2;
cin>>x1>>x2;
const Test t(x1,x2);
t.printxy( );
return 0;
}
E2 驾驭const
最新推荐文章于 2020-07-18 21:03:38 发布