阅读程序。阅读下列C++程序,对每条语句进行注释,说明其作用(请粘贴源代码或屏幕截图,不要上传附件)。 include <iostream> using namespace std; class CTest { private: int x, y; public: CTest(int p1 = 0, int p2 = 0) { x = p1; y = p2; } CTest(CTest &p) { x = p.x; y = p.y; } void Show() { cout << x << “, “ << y << endl; } }; int main() { CTest obj1; obj1.Show(); CTest obj2(2, 5); obj2.Show(); CTest obj3(obj2); obj3.Show(); return 0; }

时间:2024-05-28 09:12:19

相似题目