C++ call parent-constructor manually?

Napoleonite
Thu, 26 May 2016 10:46:15 +0000
C++

I would like to have full control over when the parent-constructor is called (it seems that UE4 calls it automatically and before the child-constructor). I have a piece of code in BaseEnemy (that inherits from BaseCharacter) that must be performed in the constructor, but before the BaseCharacter-constructor runs.

ABaseEnemy::ABaseEnemy()
{
  // <My code that must be performed before the base-constructor here>

  // Call super constructor <<<<<<<<< this is not possible?

  // The rest of my awesome code.
}

7 posts - 1 participant