I am trying to program a text baced rpg using classes for the info dealing with the equipment. i tried to use a book i have that shows me how to use classes and inheritance.
i tried something like this
Code:
class equipment
{
public:
char name[30];
int cost
}
class weapons : public equipment
{
public:
int bat_power;
}
class armor : public equipment
{
public:
int armor_bonus;
}
weapon Short_sword;
Short_sword.name = [s,h,o,r,t, ,s,w,o,r,d} // I dont think this is right for setting char
Short_sword.cost = 50;
Short_sword.bat_power = 1;
armor leather_armor;
leather_armor.name = [l,e,a,t,h,e,r, , a,r,m,o,r];
leather_armor.cost = 100;
leather_armor.armor_bonus = 1;
when i go and compile it, it gives me lots of errors like:
"missing ';' befor '}'" (it gives this on every line where a class is declared)
"left to 'leather_armor' must have class/struct/(somthing else) (it gives me this on any line that i try to get it to display the values of say leather_armor.cost)
it also gives me other errors that make absolutly no idea what they mean
please help me figure this out