shadowsilver
Programmer
Does anyone know if there is a way to send arguments to a constructor and not have to use a local copy to transfer them to their rightful homes?
Like:
class Person {
int Hlth, Att, Def;
string Name;
Person(int InitHlth, int InitAtt, int InitDef, string InitName);
}
Is there another way to do it than this? It seems sorta redundant.
Person:erson(int InitHlth, int InitAtt, int InitDef, string InitName) {
Hlth = InitHlth;
Att = InitAtt;
Def = InitDef;
Name = InitName;
}
Person Me(50, 10, 2, "Bob"
Can you do it with references or pointers? I haven't had any luck... I've tried like Person:erson(int &Hlth, int &Def, etc) but I don't know how to make it work.