class B
{
public:
B(char c = 'a') : m_c(c) {}
public:
fun();
private:
char m_c;
};
class C: virtual public B
{ };
class D: virtual public B
{ };
class E
: public C
, public D
{ };
I am just wondering how “virtual” keyword is helping that class E have only one copy of class B? What virtual keyword does at “class C” so that it impacts its derived class later(As you can understand I am just trying to understand the basic working of virtual inheritance.I tried to find out the answer of this question but didn’t get it properly , if any one knows any good link even that can be of help.). In other words, what is the difference between
//1)
class C: virtual public B
{ };
//2)
class C: public B
{ };
If we don’t drive class C any further. Will there be any particular difference between 1) and 2) while creating its object.