Why cut from PawnBase to PawnTank?


Unreal Engine C++ Course: Lecture 139 Creating Child C++ Classes
Could someone provide some clarity on:

  1. Why we need to create a new PawnTank Class if we already have a PawnBase class with all the inherited components?
  2. Removing public and protected code from the PawnBase header and placing this in the PawnTank header?
  3. By removing this code from the PawnBase, wont this break this pawn? Why not just delete it?

Thank you for any insights.
Kind Regards
Tiaan Adlem

  1. To have a common base class with the turret as they share several properties. The tank and turret classes are going to each extend that class to provide functionality for their specific needs.
  2. Because it’s not needed in the base class as those aren’t something that is common amongst the two classes.
  3. The PawnBase class isn’t really meant to be used directly, only inherited from.

Thank you DanM :slight_smile:

To anyone reading this. To get a better understanding of class inheritence and constructors as this was what was confusing me. Have a look at thenewboston youtube videos. https://www.youtube.com/user/thenewboston

He explains these principles really well

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms