Question about classes and inheritance
Say I have a class Item which overloads the assignment operator if I make a class called weapon that publicly inherits the Item class can I use the operator to assign a weapon to a item?
Now my question is will temp.a and temp.b hold sword.a and sword.b and if I did it the other way sword = temp would sword hold temp.a and temp.b in sword.a and sword.b?
void SetAB(int, int);
Item& operator = (const Item& i);
Item& Item::operator = (const Item& i)
a = i.a;
b = i.b;
void Item::SetAB(int A,int B)
a = A;
b = B;
Class Weapon : public Item
//doesnt matter i dont overload the = again
sword.SetAB(1 , 2);
temp = sword;
Also is this something thats not violating any standards of programming? Like void main() or something i mean if it works but its just bad practace.