Answer:What would be the output of the following code?
#include<iostream.h>
#include<conio.h>
class A
{
public:
virtual void disp()
{
cout<<"This is from class A";
}
};
class B : public A
{
public:
void disp()
{
cout<<"This is from class B";
}
};
void main()
{
clrscr();
A *s;
s = new B();
s->disp();
}
Options
a) This is from class A
b) This is from class B
c) This is from class A This is from class B
d) None of the above
Answer : b) This is from class B