Hello World,
I have a question about extending child classes from parent classes in Object Oriented Programming. To be specific I am talking about UnrealScript, but I am pretty sure this concept is a kin to all OOP languages.
Lets say I am making a FPS game. I have 4 different weapon types, Pistols, Shotguns, Rifles and Rocket Launchers. Obviously all of these weapons are going to have functionality that is the same like ammo, accuracy, damage and so on. So you would make a parent class with all of the common functionality and extend from that class when programming your weapons so in the child class you didn't have to rewrite all of that code.
However, what if you were writing the code for the rocket launcher for example, and you wanted most of the functionality that the weapons parent class offers, but some of it you didn't want? How would you avoid extending some of the functionality that the parent class has while still keeping most of it?
Here is some example code roughly written:
//Parent Class
class BasicWeaponFunctionality extends UTWeapon;
placeable;
//Child Class
class RocketLauncher extends BasicWeaponFunctionality;
placeable;
//How would I avoid extending the variable LockerAmmoCount from BasicWeaponFunctionality Class?
I hope I make sense, let me know if I don't so I can clarify just in case.