What will the following program display?
#include
using namespace std;class First{protected: int a;public: First(int x = 1) { a = x; } virtual void twist() { a *= 2; } int getVal() { twist(); return a; }};class Second: public First{private: int b;public: Second(int y = 5) { b = y; } virtual void twist() { b *= 10; }};int main(){ First object1; Second object2; cout ≪ object1.getVal() ≪ endl; cout ≪ object2.getVal() ≪ endl; return 0;}
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.