C++课程设计类作业3

时间:2021-10-18 06:58:59
 #include <bits/stdc++.h>
using namespace std;
class A
{
public:
A()
{
a=b=;
cout<<"Default Constructor called.\n";
}
A(int i,int j)
{
a=i;
b=j;
cout<<"Constructor called.\n";
}
~A()
{
cout<<"Destructor callled.\n";
}
void copy(A &aa);
void print()
{
cout<<a<<","<<b<<endl;
}
private:
int a,b;
};
void A::copy(A &aa)
{
if(this==&aa)
return;
*this=aa;
}
int main()
{
A a1,a2(,);
a1.copy(a2);
a1.print();
}

C++课程设计类作业3