Um, theyre as good as any, but thanks for the tip on the reference thing i forgot totally about that.
I thought that when you called the attack function and did something like this...
it would work as plannedCode:class Creature { public: Creature(int health, int attack, int defense) { statistics.Health = health; statistics.Attack = attack; statistics.Defense = defense; } struct Stats { int Health; int Attack; int Defense; }; void Attack(Creature c) { c.statistics.Health -= statistics.Attack; } Stats statistics; }; class Human : Creature { }; int main() { Creature C1(100, 25, 10); Creature C2(100, 25, 10); C1.Attack(C2); return 0; }
Guess not...



LinkBack URL
About LinkBacks



