Question:What will be the output of the following code?
class b { int i; public: virtual void vfoo() { cout <<"Base "; } }; class d1 : public b { int j; public: void vfoo() { j++; cout <<"Derived"; } }; class d2 : public d1 { int k; }; void main() { b *p, ob; d2 ob2; p = &ob; p->vfoo(); p = &ob2; p->vfoo(); }
A Base Base
B Base Derived
C Derived Base
D Derived Derived
+ AnswerB
+ Report