下面代码执行后输出结果为(&nbsp &nbsp &nbsp ) #...
发布于 2022-03-03 16:11:48
下面代码执行后输出结果为( )
#include <iostream> using namespace std class Model { private: int val public: Model(int n = 0):val(n){} Model(const Model &obj) { val = 2*obj.val } Model &operator=(const Model &obj) { val = 4*obj.val return *this } void print() { cout << val << endl } } int main( ) { Model obj1(10), obj2 = obj1, obj3 obj3 = obj1 obj2.print() obj3.print() return 0 }
登录后免费查看答案
关注者
0
被浏览
22