Answers for "c++ accessing parent class functinons"

C++
0

c++ accessing parent class functinons

class left {
public:
    void foo();
};

class right {
public:
    void foo();
};

class bottom : public left, public right {
public:
    void foo()
    {
        //base::foo();// ambiguous
        left::foo();
        right::foo();

        // and when foo() is not called for 'this':
        bottom b;
        b.left::foo();  // calls b.foo() from 'left'
        b.right::foo();  // call b.foo() from 'right'
    }
};
Posted by: Guest on October-13-2021

Code answers related to "c++ accessing parent class functinons"

Browse Popular Code Answers by Language