sorry , it's kind of a newbie question but is there any possible way to make twon objects ,for instance, with the same name member share the same data for the rest of the class members
here is the code to understand what i mean .
#include <iostream>
#include <string>
usingnamespace std;
class weapon
{
public :
string name;
int damage;
};
void betterdamage(weapon w1,weapon w2)
{
cout << w1.name << " damage is : " <<w1.damage<< endl;
cout << "Whereas " <<w2.name<< "'s damage is : " << w2.damage<< endl;
}
int main()
{
weapon weapon1;
weapon weapon2;
weapon AKM;
weapon AWM;
AKM.name = "AKM";
AWM.name = "AWM";
AKM.damage = 45;
AWM.damage = 120;
getline(cin, weapon1.name)
getline(cin, weapon2.name)
// at this moment , i want if the user types AKM to make the whole weapon1 members exactly the same as the AKM members previously input
betterdamage(weapon1,weapon2);
}