#include
CodePudding user response:
#includeusing namespace std;//namespace
//class name
The class CTest
{
Private:
Int x, y;//private member variables
Public:
//the constructor
CTest (int p1=0, int p2=0)
{
X=p1.//p1 assigned to x
Y=p2;//p2 assigned to y
}
//copy constructor
CTest (CTest & amp; P)
{
X=p.x;//assignment
Y=p.y;//assignment
}
//normal function, print the x, y
Void the Show ()
{
cout
};
Int main ()
{
CTest obj1;//class variables obj1
Obj1. The Show ();//call the print function Show
CTest obj2 (2, 5);//class variables obj2
Obj2. The Show ();//call the print function Show
CTest obj3 (obj2);//class variables obj3, calls the copy constructor
Obj3. The Show ();//call the Show
return 0;
}