Dominance (C++)

From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search

In the C++ programming language, dominance implies a specific behaviour of symbol disambiguation in virtual inheritance. Consider the following example:

class Parent
{
public:
    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.

See also


If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...