What will be the output of the following code?
#include<iostream>
using namespace std;
class b
{
int i;
public:
void vfoo()
{ cout <<"In Base "; }
};
class d : public b
{
int j;
public:
void vfoo()
{
cout<<"In Derived ";
}
};
void main()
{
b *p, ob;
d ob2;
p = &ob;
p->vfoo();
p = &ob2;
p->vfoo();
ob2.vfoo();
}
Correct Answer: In Base In Base In Derived
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More C++ MCQ Questions