>> the flamethrower works differently then the gun
Does it?
The flamethrower shoots and so does the gun.
The flamethrower has some mass and so does the gun
The flamethrower can run empty and so does the gun.The point here is that, they do differ internally, but not so much
externally. Thus a solution to your problem is to create a hierarchy
with virtual and pure virtual functions, as pointed out already, while
making the have the same functions like shoot() or destroy(), or whatever.
You are absolutely right, alle weapons got;
- Shoot
- Reload
- ReloadTime
- IsRealoading
- Fireing Speed
- ect.
However, the flamethrower works in a totally differentmanner, ie. calling my particle engine, while my MachineGunClass, simply calls a glPoint.
Just to be sure before, I'm marking this as solved, then I would just make a class like this, right?
class WeaponMasterClass
{
virtual Shoot();
virtual Reload();
virtual BulletsLeftInClip();
virtual IsReloading();
// virtual vars I need, ect.
};
And then calling this, with it set equal to some other weaponobject, lets say the flamethrower, would make it use the flamethrowers shoot, instead, since it's virtual?
P.S.: Virtual, vs. Pure Virtual?