Discussion
Ask a question about 'Dominance (C++)'
Start a new discussion about 'Dominance (C++)'
Answer questions from other users
|
In the
C++C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
programming language,
dominance implies a specific behaviour of symbol disambiguation in
virtual inheritanceVirtual inheritance is a topic of object-oriented programming. It is a kind of inheritance in which the part of the object that belongs to the virtual base class becomes common direct base for the derived class and any next class that derives from it...
. Consider the following example:
class Parent
{
public:
virtual void function;
};
class Child1 : public virtual Parent
{
public:
void function;
};
class Child2 : public virtual Parent
{
};
class Grandchild : public Child1, public Child2
{
public:
Grandchild
{
function;
}
};
In the Grandchild call to function, Child1::function is implied, because Child1 is derived from Parent and thus Child1::function "dominates" Parent::function.