Overloads of inherited member functions

前端 未结 3 1875
故里飘歌
故里飘歌 2020-12-16 14:42

Can a class overload methods that also exist in the publicly inherited interface? It seems like this is unambiguous and useful, but compilers (VC, Intel, GCC) all complain,

3条回答
  •  余生分开走
    2020-12-16 15:19

    This is called hiding the parent member function. You can explicitly call it (by Bound::rebound(left, right) as @Ates Goral said) or you can add a using Bound::rebound in your Node class definition.

    See http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9 for more info.

提交回复
热议问题