Call base class method from derived class object

前端 未结 4 824
不知归路
不知归路 2020-12-02 17:15

How can I call a base class method which is overridden by the derived class, from a derived class object?

class Base{
  public:
    void foo(){cout<<\"         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-02 17:42

    An important [additional] note: you will still have compilation errors if Name Hiding occurs.

    In this case, either utilize the using keyword, or use the qualifer. Additionally, see this answer as well.

    #include 
    
    class Base{
      public:
        void foo(bool bOne, bool bTwo){std::cout<<"base"<

提交回复
热议问题