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