Hi, I'm trying to call the functions of a child class from a pointer to the parent class which are not virtual functions.
Basically I'm creating a racing game. I have a particle model class for physics on
normal gameobjects and I have created a CarParticleModel which is specifically for the cars and is a child of ParticleModel.
class CarParticleModel : public ParticleModel
CarParticleModel* carParticleModel = new CarParticleModel(carMovement);
GameObject* mCar1Object = new GameObject("Car1", cubeAppearance, carMovement, carParticleModel);
When creating a GameObject it takes in a pointer to a ParticleModel so I only access functions in that class when using this line of code.
mCar1Object->GetParticleModel()->myfunctions(); //Only access function in ParticleModel but has a pointer to CarParticleModel.
Basically I need to access functions in the child class but can't use virtual functions because CarParticleModel has functions like 'SetEngineSpeed' which is too specific to add to ParticleModel which has functions like 'SetVelocity'.
This is part of my university assignment. Each GameObject has to have a ParticleModel or a nullptr (For no physics). Then for the car GameObject we have to have a CarParticleModel as a child of ParticleModel. I'm guessing that I should have a CarParticleModel pointer in the ParticleModel class and call that to get the child functions?