i have seen this word in interview question .
i don't know if this kind of thing is existing or not. may be it is same as multiple path inheritance(diamond problem)!
Printable View
i have seen this word in interview question .
i don't know if this kind of thing is existing or not. may be it is same as multiple path inheritance(diamond problem)!
Look here
I have never heard of the specific term "virtual path inheritance", but C_ntua seems to think that it is the same thing as virtual inheritance.
The "diamond of death" refers to a derived class having more than one instance of a base class through multiple inheritence, in circumstances where only one instance is wanted.
An example of the hierarchy is;
Problems associated with the "diamond of death" are resolved by declaring the Base to be a virtual base of both A and B.Code:class Base
{
// members
};
class A : public Base
{
// members
};
class B : public Base
{
// members
};
class Derived : public A, public B
{
// members
}
Doing this achieves what is sometimes described as "virtual path inheritence". Personally, I consider it a woeful description, but some people seem to like it.
Did anybody here actually ever encounter this problem? I've coded quite a lot in C++, all object oriented, but I've never created a diamond pattern...
There is the rather famous example of std::basic_ios, std::basic_istream, std::basic_ostream and std::basic_iostream.Quote:
Originally Posted by EVOEx