I have some classes that have outline like this
class A{
//class A elements
A(typeA1 A1, typeA2 A2, ....){//initialize elements}
}
class B extends A{
//class B elements
B(typeA1 A1, typeA2 A2,...... typeB1 B1, typeB2 B2, ....)
{
super(typeA1 A1, typeA2 A2,......);
//initialize B elements
}
}
What I am doing to construct B class is pass arguments of both A and B to B's constructor and then call A's constructor through it.
But this gets dirty as number of elements go on increasing. What is a better(maybe with less no of arguments?) way to achieve this?