Where to use classes, when creating games (newbie here)?
Posted: Sun Aug 29, 2010 8:15 am
I was reading about classes and reading... They are like defining variables. Like:
class var
{
int armor = 100;
int hp = 100;
};
is equivalent to:
int main()
{
int armor = 100;
int hp = 100;
}
So what's the point of using classes at all? Or there's some another usage or something to make the code easier to read and better, which i don't know of?
I've read 2 tutorials and 3 forum threads about classes (big threads), and there was only such things, as i wrote above... So i don't get it, is there some "special usage", they didn't mentioned, or it's just some fancy way to declare variables?
class var
{
int armor = 100;
int hp = 100;
};
is equivalent to:
int main()
{
int armor = 100;
int hp = 100;
}
So what's the point of using classes at all? Or there's some another usage or something to make the code easier to read and better, which i don't know of?
I've read 2 tutorials and 3 forum threads about classes (big threads), and there was only such things, as i wrote above... So i don't get it, is there some "special usage", they didn't mentioned, or it's just some fancy way to declare variables?