/*
*copyright(c) 2014,烟台大学计算机学院
*All rights reserved
*文件名称:test.cpp
*作者:吴雨凡
*版本:v6.0
*
*问题描述:类和指针程序阅读(3)
*输入描述:
*程序输出:判断相关问题
*/
#include <iostream>
using namespace std;
class AA
{
public:
AA(int i,int j)
{
A=i;
B=j;
cout<<"Constructor\n";
}
AA(AA &obj)
{
A=obj.A+1;
B=obj.B+2;
cout<<"Copy_Constructor\n";
}
~AA() {
cout<<"Destructor\n";
}
void print()
{
cout<<"A="<<A<<",B="<<B<<endl;
}
private:
int A,B;
};
int main()
{
AA a1(2,3);
AA a2(a1);
a2.print();
AA *pa=new AA(5,6);
pa->print();
delete pa;
return 0;
}