J
JoeC
I have been writing a game and some of my objects have objecs as
members of that I have a graphic with a color or unit with a coord
structure.
If I have a:
class unit{
color cl;
int attackFactor;
.....
.....
When I create the object, I create an empty color but I have a color
constructor:
color::color(int r, int g, int b);
I want to create the unit
unit::unit(int af, int r, int g, int b);
attackFactor =af;
color(r,g,b);
My unit objects will have quite a bit of data so I want to load all the
information with istream from a text file. How can I use constructor
for the member objects of my unit object or any other object that is a
member of another object.
members of that I have a graphic with a color or unit with a coord
structure.
If I have a:
class unit{
color cl;
int attackFactor;
.....
.....
When I create the object, I create an empty color but I have a color
constructor:
color::color(int r, int g, int b);
I want to create the unit
unit::unit(int af, int r, int g, int b);
attackFactor =af;
color(r,g,b);
My unit objects will have quite a bit of data so I want to load all the
information with istream from a text file. How can I use constructor
for the member objects of my unit object or any other object that is a
member of another object.