Answer Posted / ragib nasir ahmed
A virtual base class is one in which only one copy of the
base class is inherited to the derived class.
Let us consider the classes A,B,C,D
class A
{
int a;
public:
void geta(void)
{
a=10;
}
};
class B: public virtual A
{
int b;
public:
void getb(void)
{
b=20;
}
};
class C:virtual public A
{
int c;
public:
void getc(void)
{
c=30;
}
};
class D:public B,public C
{
public:
void display(void)
{
cout<<a<<b<<c<<d;
}
};
Is This Answer Correct ? | 25 Yes | 2 No |
Post New Answer View All Answers
an integer constant must have atleast one a) character b) digit c) decimal point
What is oops in simple words?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
What is the difference between containment and delegation?
Do you know about C++ 11 standard?
What is heap sort in c++?
Explain explicit container.
What is destructor give example?
Explain how the virtual base class is different from the conventional base classes of the opps.
What is an advantage of polymorphism?
What is encapsulation oop?
Is enum a class?
What is abstraction in oop with example?
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
How does java differ from c and c++?