Whenever a derived class requires direct inheritance from a base class, even if it inherits that base class indirectly. That is, if V is a base class from which B is derived, and D is derived from B, then D inherits from V indirectly (through B). But if B is virtually derived from V, then D will inherit directly from V.
This feature is commonly used in conjunction with multiple inheritance. Examine the following declarations:
class V{};
class B1: public V{};
class B2: public V{};
class M: public B1, public B2{};
Now suppose you have the following code:
M m; // Declare an instance of M.
V& v = m; // Ambiguous...
The problem with this is that M inherits V from both B1 and B2, and therefore inherits two separate instances of V. The compiler is unable to determine which instance of V you want to refer to. One solution to this would be to use static casts to indirectly refer to an explicit instance of V:
V& v = static_cast<B1&>(m);
or
V& v = static_cast<B2&>(m);
While this is certainly workable, it is an ugly approach that places far too much responsibility upon the programmer to ensure the correct instance of V is being referred to. However, unless there is a specific need to have two instances of V within M, the problem can be resolved with virtual inheritance.
By virtually deriving both B1 and B2 from V, M will directly inherit just one instance of V, which is then shared, virtually, between B1 and B2:
class V{};
class B1: public virtual V{};
class B2: public virtual V{};
class M: public B1, public B2{};
M m;
V& v = m; // No ambiguity.
Now M can access all the members of V directly, as can B1 and B2, because they now share the same instance of V.
Note that it doesn't matter whether the virtual keyword is placed before or after the access specifier (which is public in this case). "virtual public" and "public virtual" have the same meaning.
you go to google type in how you can make a virtual world
virtual villagers 5 has already been made. it is called virtual villagers new believers.
No i does not.
in virtual we select the custom specific virtual network and other in bridgenetwork
Well, virtual families and virtual families 2 are good. They are by the game producers Last Day of Work, who also make virtual villagers.
It can make you addicted
Barbie.com
go onto youtube and type in (') how to make a virtual world website (') without the comas and brackets. then it may tell you
Using VastPark Creator.
You don't....
Anyone can be the chief, you make them be it :)
HOW should we know.