Question:
Observe the following C++ code and answer the questions (i) and (ii).
Note: Assume all necessary files are included.
class Point
{
int X,Y;
public:
Point(int I=10, int J=20) //Function 1
{
X=J;
Y=I;
}
void Show() //Function 2
{
cout<<"Points are"<<X<<"&"<<Y<<endl;
}
~Point() //Function 3
{
cout<<"Points Erased"<<endl;
}
};
void main()
{
Point P(5);
P.Show();
}
(i) For the class Point, what is Function 3 known as ? When is it executed ?
(ii) What is the output of the above code, on execution ?
C. Sir| Created: 8-Apr-2019 | Updated: 10-Apr-2019|CBSE12A-2019
