Hello, im new with Object oriented programming.
I'm having a problem with a structure, what I'm trying to do is to make a function to create a sub structure named depending on what the input is, let me show what ive done.
Now, I get an error that says: (declaration of 'Weapon name' shadows a parameter ).Code:items.h
struct Weapon
{
// Strings
string mName;
string mQuality;
// Integers
int mItemID;
int mGoldValue;
int mDamageLow;
int mDamageHigh;
};
items.cpp
void Create(string name, string qual, int ID, int value, int dmgLow, int dmgHigh)
{
Weapon name;
name.mName = name;
name.mQuality = qual;
name.mItemID = ID;
name.mGoldValue = value;
name.mDamageLow = dmgLow;
name.mDamageHigh = dmgHigh;
}
Obviously I'm doing something wrong since im trying to make the parameter "name" be the name of the sub structure, for example: if user puts in "ShortSword" the name of it should be
"ShortSword.mName", and so on...
So is there any easier (working?) way to do this?
Thanks in advance.

