看到很多代码里有 __super 比如,__super::function(),
这个 __super 到底是什么呢?
还有些类似的,都是啥子喃?谢谢!

解决方案 »

  1.   

    Allows you to explicitly state that you are calling a base-class implementation for a function that you are overriding.  
    __super::member_function();
     
    // deriv_super.cpp
    // compile with: /c
    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)
       }
    };
      

  2.   

    用到__super的都是继承基类的对象。
    __super指向基类如在窗体类中
    __super::OnOK()跟CDialog::OnOK()是一样的
      

  3.   

    __super 这个后面的函数 执行的是父类的