Quote:Original post by dmatterQuote:Original post by 3shirtlessmenWeapon and ProjectileWeapon (or RangedWeapon)? That's one way, it'll certainly work.
I could have 2 abstract weapons class, ones that have ammo and those that don't.Quote:Alright, I *thought* I did that ... still the abstract error on 'attack' ... why?Are you suffering from overload versus override syndrome? Note the difference between these:
int Weapon::attack(int, int)
int LandMine::attack(int) // This is an overload NOT an override
You must override virtual functions in order to provide implementations for them.
Thanks!
Overriding - in this case, give int attack(int) a body in landmine? I did that - it compiles.
Also, why does it work that way? Reason being,
I assume that all weapons can 'attack' - however, not all weapons attack the same way. Which may lead to convoluted code.
My abstract super class allows for a attack(void); however, with my land mine - I want the size of the landmine to effect the damage, so, I need now, 2 attack functions to have this work ... I don't understand the logic.