I built an object called Attribute, this object has full copy and empty constructor. Then I built another object called Human, which contains the Attribute object. When I try to build the human class (with full constructor) somehow it automatically calls the Attribute copy constructor and I have no idea why.
here is the code:
char** d = new char*[3];
d[0] = new char[10];
d[0] = "aa";
d[1] = new char[10];
d[1] = "bb";
d[2] = new char[10];
d[2] = "cc";
Attribute *a = new Attribute(1.7, "blue", "white", "black", d, 3);
Human *h = new Human("Name", *a);
When I use the debugger and get to this line: new Human("Name", *a); it automatically enters this function:
Attribute::Attribute(Attribute& copy)
{
Attribute(copy.height, copy.eyeColor, copy.skinColor, copy.hairColor, copy.diseases, copy.numOfDiseases);
}
and only after this function ends, it starts the Human full constructor...