So basically what I want is to know the best way or easy way to ideally get the compiler to throw an error if a variable I assign to an abstract class goes unassigned in value.
For example
if I have an abstract weapon class, pretty much all weapons will have a rate of fire and a Fire function.
Now i can declare a Fire function and if i don’t do something with that function in a class that inherits I get tossed an error. If I have the variable RateOfFire though and never assign it no error is thrown.
This becomes a problem because like if i have a projectile base class and it has a damage value. I want to set a damage value for each of the “bullet” types in my game. However if i forget it could take quit a while to figure out why i’m getting a damage of 0 or 1 or whatever the default is or even the last weapons damage or whatever.
Basically even if perhaps i have a stun weapon that does zero damage i’d like to specify it does zero damage because i’d rather it toss an error and type damage = 0; than end up forgetting to make my rockets do damage and go WTF why isn’t anything dying or its sometimes dying after I shoot and maybe sometimes it 1 hit kills cause it has the damage of my nuke weapon i just used or something.
Should i use a if statement or something or what is there a way to force a class variable to be specifically assigned a variable by an inheriting function?