Commit 2bae2e3d authored by Hans Buchmann's avatar Hans Buchmann

constructor/destructor exercise.pdf 1.1

parent 9d049324
......@@ -31,9 +31,67 @@ Point::~Point()
std::cout<<"destructor Point "<<xc<<","<<yc<<"\n";
}
/*
{
{
Point p(1,1);
}
Point q(2,2);
Point r(3,3);
}
constructor Point 1,1
destructor Point 1,1
constructor Point 2,2
constructor Point 3,3
destructor Point 3,3
destructor Point 2,2
*/
/*
{
{
Point p(1,1);
{
Point q(2,2);
{
Point r(3,3);
}
}
}
constructor Point 1,1
constructor Point 2,2
constructor Point 3,3
destructor Point 3,3
destructor Point 2,2
destructor Point 1,1
*/
/*
{
Point p(1,1); //instance of class Point defined and initalized constructor
Point q(2,2);
Point r(3,3);
}
constructor Point 1,1
constructor Point 2,2
constructor Point 3,3
destructor Point 3,3
destructor Point 2,2
destructor Point 1,1
*/
//--------------------------- use case
int main(int argc,char** args)
{
Point p(3.14,2.7); //instance of class Point
{
Point p(1,1); //constructor p
{
Point q(2,2); //constructor q
{
Point r(3,3); //constructor r
} //destructor r
}//destructor q
return 0;
},
} //destructor p
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment