C++ output type question

Q.  C++ : Trace the output.

class base
{
private: int x;
protected: int y;
public:
base()
{
   x=10;
   y=20;
}
};
class derived : public base
{
protected:
int a, b;
void change( )
{
a=x;
b=y;
cout << a << b;
}
};
void main()
{
derived  obj;
obj.change();
}

- Published on 23 Jun 15

a. 10 20
b. Run time error.
c. Compile time error.
d. None of the above

ANSWER: Compile time error.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)