What will the following program display?
#include
using namespace std;
class Base
{
protected:
int baseVar;
public:
Base(int val = 2) { baseVar = val; }
int getVar() const { return baseVar; }
};
class Derived : public Base
{
private:
int deriVar;
public:
Derived(int val = 100) { deriVar = val; }
int getVar() const { return deriVar; }
};
int main()
{
Base *optr;
Derived object;
optr = &object;
cout << optr->getVar() << 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.