SUPER word to run parent class function

I don’t understand how does unreal Engine uses Super. I read Super in java and other languages but i think C++ way of calling parent class function is:

void Base::FooBar()
{
   printf("in Base\n");
}

void ChildOfBase::FooBar()
{
  Base::FooBar();
}

Ben please correct me if I am wrong. I Googled and found on stackoverflow[ this]
(http://stackoverflow.com/questions/180601/using-super-in-c)

The guy in this link says he uses a typedef to create an alias so he can actually use super

class Child : public PapaClass
{
    public:
         typedef PapaClass super;    // or in Unreal's case Super

         Child(int i, int j) : super(i,j) 
         {}
}

even when calling function

void Child::foo()
{
       super::foo();
}

But the person who answered this question says that super is not gonna be standard. So, the only doubt I’m left with is: Unreal Engine followed similar kind of strategy to introduce Super?

From UE4 Entry Level Guide to UE4 C++:

Super::Init(InEngineLoop).
Because the Init function is virtual, you can call the Super class version of the function (and you should!)

Super itself means the super class of UUnrealEdEngine.

This is UE4 specific way of calling the parent class, not standard c++.

2 Likes

Indeed, this is UE4’s standard, but not C++’s standard. UE4 does a lot of behind-the-scenes action (like Super, for example) that helps streamline the development process so that you can focus more on developing your game, and less on trivial code.

1 Like

Privacy & Terms