#include2、tring.h>classStudent{public:Student(char*pName="noname",intssId=0){strncpy(name,pName,40);name[39]=' ';id=ssId;cout<<"Constructingnewstudent"<3、=s.id;}~Student(){cout<<"Destructing"<4、y);//调用fn函数,参数传递时调用拷贝构造函数cout<<"Returnedfromfn()";}//主函数调用结束时,先析构对象wang,再析构对象randy程序的运行结果为:ConstructingnewstudentRandyConstructingnewstudentwangCallingfn()ConstructingcopyofRandyInfunctionfn()DestructingcopyofRandyReturnedfromfn()DestructingwangDestructingRandy缺省构造函数
5、#include#includeusingnamespacestd;classStudent{public:Student(char*pName){cout<<"calloneparameterconstructor"<