Hey, today I was doing some programming and I have come to a little confusion.
An array of Objects.
I get objects, and classes and even constructors. But I can't imagine an array of constructors with classes.
e.g.
Code:
class Human
{
private:
float height, weight ;
public:
Human(float,float) ;
void setMeasurements(float,float) ;
}
Human::Human(float height, float weight)
{
setMeasurements(height,weight) ;
}
Human::setMeasureMents(float height,float weight)
{
Human::height = height ;
Human::weight = weight ;
}
int main(void)
{
Human Eman(15.0f,20.0f) ; //Wow I get this part easy
//when I create an object of userdefined type Human, a constructor is called
//with 15 and 20 passed as arguments this I send to setM and so on....
//but this I don't get an array of object
Human multipleMe[10] = {(20.0f,10.0f),(18.0f,20.0f)...} ;
i'm so confused :S , how is it that constructor parameters (don't know how to describe them) is initialized as the values for multipleMe?
Thanks
return 0 ;
}