What is the output of the following C++ program?
#include#include using namespace std;class baseClass{public:void print ( ) const;baseClass(string s = &“ ”, int a = 0);//Postcondition: str = s; x = aprotected:int x;private:string str;};class derivedClass: public baseClass{public:void print ( ) const;derivedClass(string s = &“ ”, int a = 0, int b = 0);//Postcondition: str = s; x = a; y = bprivate:int y;};int main ( ){baseClass baseObject(“This is base class”, 2);derivedClass derivedObject (“DDDDDD”, 3, 7);baseObj ect.print( );derivedObject. print ( );return 0;}void baseClass::print ( ) const {cout ≪ x ≪ “ ” ≪ str ≪ endl;}baseClass::baseClass(string s, int a){str = s; x = a;void derivedClass::print ( ) const{cout ≪ “Derived class:” ≪ y ≪ end1;baseClass::print ( );}derivedClass::derivedClass(string s, int a, int b):baseClass(“Hello Base”, a + b){y = b;}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.