Solved

What Is the Output of the Following Program? #Include ≪iostream> \quad

Question 40

Multiple Choice

What is the output of the following program? #include <iostream>
Using namespace std;
class bClass
{
public:
\quad void print() const;
\quad bClass(int a = 0,int b = 0) ;
\quad\quad //Postcondition: x = a; y = b;
private:
\quad int x;
\quad int y;
};
class dClass: public bClass
{
Public:
\quad void print() const;
\quad dClass(int a = 0,int b = 0,int c = 0) ;
\quad\quad //Postcondition: x = a; y = b; z = c;
private:
\quad int z;
};
Int main()
{
\quad bClass bObject(2,3) ;
\quad dClass dObject(3,5,8) ;
\quad bObject.print() ;
\quad Cout << endl;
\quad dObject.print() ;
\quad cout << endl;
\quad return 0 ;
}
void bClass::print() const
{
\quad cout << x << " " << y << endl;
}
bClass::bClass(int a,int b)
{
\quad x = a;
\quad y = b;
}
void dClass::print() const
{
\quad bClass:print() ;
\quad cout << " " << z << endl;
}
\quad dClass::dClass(int a,int b,int c)
\quad\quad : bClass(a,b)
{
\quad Z = c;
}


A)
2 3
2 3

B)
2 3
3 5 8

C)
3 5 8
3 5 8

D)
5 8
3 5 8

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents