/* time:2020年4月24日21:24:31 where:gfdx function:对象赋值*/ #include<iostream> using namespace std; class myclass { int a, b; public: void set(int i, int j) { a = i; b = j; } void show() { cout <<a<<" " << b << endl; } }; int main() { myclass o1, o2; o1.set(20, 5); o2 = o1;//将对象o1的值赋给对象o2 o1.show(); o2.show(); }
对象赋值
猜你喜欢
转载自www.cnblogs.com/qq1480040000/p/12770380.html
今日推荐
周排行