constructor??!!?

hi,
i have a class that have two objects as a private members so,
now i want to initailize the 2 objects through the constructor
should i but the parameter consecutive of each object even though
they are the same?!!
like this:
calenderType(int Day=1,int Month=1, int Year=1500,int DAY=1,int MONTH=1 ,int YEAR=1500,std::string M="January")

can any one help me pleas i feel confuse!
Last edited on
I don't understand the question.

What's the form of your class?

1
2
3
4
class calenderType
{
//What's in here?
};
If you want two instances of the class, you need to create (construct) two instances of the class, so call the constructor twice.

I see a lot of people have an over-ridden "copy" constructor for when they want to make one object identical to another, so maybe you could implement one of those?

Having a variable "Day" and a variable "DAY", both of the same type, is just going to lead to confusion, I think - even though that's only in your constructor, I'd still recommend changing that (why do you want to take the same values twice anyway?).

And yes, what wasabi said - your question is a little difficult to decipher.
see xoax.net videos

you don't need to pass in the address of your private members since its in the same scope(class scope).

all you have to pass through are your variables you need to assign the data to your private members.

private members somewhat like a hid-jab(BURKA) wearer, they can only be used inside a class function(constructor or destructor), (THE HOUSE) this is were you the programmer can do what ever you want with it.

this is a crude analogy, but its the truth and I'm sure it'll stick in your brain



Topic archived. No new replies allowed.