What will be the output of the following program? #include<iostream.h>
class CuriousTab
{
int x, y;
public:
CuriousTab(int xx)
{
x = ++xx;
}
~CuriousTab()
{
cout<< x - 1 << " ";
}
void Display()
{
cout<< --x + 1 << " ";
}
};
int main()
{
CuriousTab objCuriousTab(5);
objCuriousTab.Display();
int *p = (int*) &objCuriousTab;
*p = 40;
objCuriousTab.Display();
return 0;
}
Discussion & Comments