What is the output of the following program?
#includeusing namespace std;class baseClass{public:void print ( )const;int getX ( );baseClass(int a = 0);protected:int x;};class derivedClass: public baseClass{public:void print ( )const;int getResult ( );derivedClass (int a = 0, int b = 0);private:int y;};int main ( ){baseClass baseObject(7);derivedClass derivedObject(3,8);baseObj ect.print ( );derivedObject.print ( );cout ≪ “**** ” ≪ baseObject.getX() ≪ end1;cout ≪ “#### ” ≪ derivedObject.getResult() ≪ end1;return 0;}void baseClass::print() const{cout ≪"In base: x = " ≪ x ≪ end1;}baseClass::baseClass(int a){x = a;}int baseClass::getX(){return x;}void derivedClass::print() const{cout ≪ "In derived: x = " ≪ x ≪ ", y = " ≪ y ≪ ", x + y = " ≪ x + y ≪ end1;}int derivedClass::getResult(){return x + y;}derivedClass::derivedClass(int a, int b):baseClass(a){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.