Code:
class Creature
{
struct Stats
{
int Health;
int Attack;
int Defense;
};
Creature Attack(Creature A)
{
A::Stats::Health - Creature::Stats::Attack;
}
};
class Human : Creature
{
};
Okay, so my attack function throws out multiple errors
Code:
c:\documents and settings\home\my documents\visual studio 2005\projects\syntax testing 2\syntax testing 2\testing.cpp(17) : error C2653: 'A' : is not a class or namespace name
c:\documents and settings\home\my documents\visual studio 2005\projects\syntax testing 2\syntax testing 2\testing.cpp(17) : error C2065: 'Health' : undeclared identifier
c:\documents and settings\home\my documents\visual studio 2005\projects\syntax testing 2\syntax testing 2\testing.cpp(17) : error C2326: 'Creature Creature::Attack(Creature)' : function cannot access 'Creature::Stats::Attack'
So I can't really figure out what is wrong with my syntax, I know I need the input creatures health to be decreased by the attackers attack number... But it just isn't working as simple as I'd like..
Help?