hello,
say i want to create a new instance of a class which has quite a lot of members.
is it better to provide them all as parameters to the constructor or to assign them all as public variables.
example1:
//constructor
I::I(type var1, type var2, type var3, type var4, ...)
{
x1 = var1;
x2 = var2;
x3 = var3;
x4 = var4;
}
var * I = new I(var1, var2, var3, var4, ...);
;
example2:
var * I = new I();
I->x1 = var1;
I->x2 = var2;
I->x3 = var3;
I->x4 = var4;
...
the problem is, i really have a lot of variables and the constructor looks kinda weird with all these parameters.