My class has two constructors
class test()
// declare
par1 as object, par2 as object , par3 as object
// constructors
public test(par1, par2) {,,,,}
public test(par1, par2, par3) {,,,,,}
// Methods
fct1()
{
'' do something with par1 and par2
}
fct2(){
if(par3 is null)
throw exception ('be sure to use the right constructor )
else
'' do something with par1 and par2
and par3
}
my question :
is it OK to have two constructors like that :
because if some one need to use fct2 he should use constructor number 2 (with 3 parameters) else it is going to throw an exception
is it OK or is there any other better solution
ps: this class is implemented every where if i change first constructor i need to change every place where the class is called
thank you .