Code:
Item& Item::operator=(const Item &rhs)
{
// Only do assignment if RHS is a different object from this.
if (this != &rhs)
{
Use_SND = rhs.Use_SND;
Miss_SND = rhs.Miss_SND;
Hit_SND = rhs.Hit_SND;
Swing_SND = rhs.Swing_SND;
ItemName = rhs.ItemName;
PIC = rhs.PIC;
ID = rhs.ID;
size = rhs.size;
min_damage = rhs.min_damage;
max_damage = rhs.max_damage;
min_heal = rhs.min_heal;
max_heal = rhs.max_heal;
min_restore = rhs.min_restore;
max_restore = rhs.max_restore;
armor = rhs.armor;
type = rhs.type;
Consumable = rhs.Consumable;
level = rhs.level;
for(int aq = 0;aq<5;aq++)
{
enhancements[aq] = rhs.enhancements[aq];
}
}
return *this;
}
Basicly this does the same deal. I was wondering if my syntax was correct with the example code I had it seemed a little odd to me, but it did compile which never means anything about the functionality of the code thanks for the reply though.