__super

__super::member_function();
        The __super keyword allows you to explicitly state that you are calling a base-class implementation for a function that you are overriding. All accessible base-class methods are considered during the overload resolution phase, and the function that provides the best match is the one that is called.

struct B1 {
   void mf(int) {
      // ...
   }
};

struct B2 {
   void mf(short) {
      // ...
   }

   void mf(char) {
      // ...
   }
};

struct D : B1, B2 {
   void mf(short) {
      __super::mf(1);    // Calls B1::mf(int)
      __super::mf('s');  // Calls B2::mf(char)
   }
};

int main() {
}

这样子成员函数能够调用父的成员函数




posted @ 2015-12-30 17:37  hrhguanli  阅读(186)  评论(0编辑  收藏  举报