Objectives :
- myConstructDeclDef1.cpp
class myConstruct2
{
private: int n1;
public:
myConstruct2():n1(200){ cout<<"\n \t \b what is mc1 " <<n1; }
//declared copy constructor
myConstruct2(myConstruct2 &arg, int n2);
}
//
//defining copyconstructor and integer parameter
myConstruct2::myConstruct2(myConstruct2 &arg, int n2):n1(n2)
{
cout<<"\n myConstruct2::myConstruct2";
cout<<"\n \t \b (myConstruct2 &arg, int n2):n1(n2) "<< n2;
cout<<"\n \t \b private integer refreshed n1 " << n1;
}
- constructor declared and defined separately outside the
class braces.
- code:
myConstructDeclDef1.txt
|