What is the output of the following program? #include <iostream>
Using namespace std;
class bClass
{
public:
void print() const;
bClass(int a = 0,int b = 0) ;
//Postcondition: x = a; y = b;
private:
int x;
int y;
};
class dClass: public bClass
{
Public:
void print() const;
dClass(int a = 0,int b = 0,int c = 0) ;
//Postcondition: x = a; y = b; z = c;
private:
int z;
};
Int main()
{
bClass bObject(2,3) ;
dClass dObject(3,5,8) ;
bObject.print() ;
Cout << endl;
dObject.print() ;
cout << endl;
return 0 ;
}
void bClass::print() const
{
cout << x << " " << y << endl;
}
bClass::bClass(int a,int b)
{
x = a;
y = b;
}
void dClass::print() const
{
bClass:print() ;
cout << " " << z << endl;
}
dClass::dClass(int a,int b,int c)
: bClass(a,b)
{
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:
Verified
Q21: To _ a public member function of
Q22: The _ members of an object form
Q24: _ is the ability to combine data,
Q28: In _ (aggregation), one or more members
Q32: _ is the ability to use the
Q40: If inheritance is public, all protected members
Q41: The OOP terminology is influenced by the
Q42: In object-oriented design,we debug _; in structured
Q43: Objects are created when _ variables are
Q44: In C++,we implement ADT through the use
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents