关键字 __super 是 Microsoft 特定的。它用于访问父类的虚方法。您知道 borland c++/delphi 编译器的替代关键字吗?
class MyBaseClass
{
virtual void DoSomething();
};
class MyDerivedClass : public MyBaseClass
{
virtual void DoSomething();
};
void MyBaseClass::DoSomething()
{
// some code
}
void MyDerivedClass::DoSomething()
{
__super::DoSomething(); // calls implementation of base class - no need to know name of base class
// implementation specific to derived class adding new functionality
}
最佳答案
Delphi 中的等价物是 inherited
.据我所知,C++ Builder 中没有等效项,当然 __super
是一个非标准的 MS 扩展。
关于c++ - Borland/Delphi 替代 __super 关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8326309/