Search code examples
c++delphicompiler-constructionc++builder

Borland / Delphi alternative to __super keyword


Keyword __super is Microsoft specific. It is used to access virtual methods of parent class. Do you know alternative keywords for Borland C++/Delphi compilers?

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
}

Solution

  • The equivalent in Delphi is inherited. So far as I know, there is no equivalent in C++ Builder and of course __super is a non-standard MS extension.