Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming Quiz 3 – What will be the output of the program given below?

Question: What will be the output of the program given below?

#include
class BixBase
{
int x;
public:
BixBase(int xx = 0)
{
x = xx;
}
void Display()
{
cout<< x ; } }; class BixDerived : public BixBase { int y; public: BixDerived(int yy = 0) { y = yy; } void Display() { cout<< y ; } }; int main() { BixBase objBase(10); BixBase &objRef = objBase; BixDerived objDev(20); objRef = objDev; objDev.Display(); return 0; }

[A].0
[B].10
[C].20
[D].Garbage-value 

Answer: Option C