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
What is a set in c++?
What is the difference between set and map in c++?
What is stl in c++ with example?
Explain the difference between using macro and inline functions?
What is stl containers in c++?
write a program that will accept a number and print.its equivalent in words the maximum input number is 9999
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
Define the operators that can be used with a pointer.
What is c++ redistributable?
Describe Trees using C++ with an example.
What is an inclusion guard?
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
What is the advantage of oop over procedural language?
Is python written in c or c++?
How can you overcome the diamond problem in inheritance?