What will be the output of the following program? #include<iostream.h>
class CuriousTabBase
{
public:
float x;
};
class CuriousTabDerived : public CuriousTabBase
{
public:
char ch;
void Process()
{
ch = (int)((x=12.0)/3.0);
}
void Display()
{
cout<< (int)ch;
}
};
int main()
{
class CuriousTabDerived *objDev = new CuriousTabDerived;
objDev->Process();
objDev->Display();
return 0;
}
Correct Answer: The program will print the output 4.
Discussion & Comments