I am trying to make the inheriting class ask for less arguments, and calculate the 'correct' mising arguments for the super class. Looking for help on how to do this, without using factory methods.
This is an example code to simplify things. Son(int) will call super(int,boolean) based on the value of int.
class Base {
...
public Base (int num, boolean boo2) { ...}
...
}
class Son extends Base {
...
public Son (int num) {
if (num > 17)
super(num, true);
else
super(num , false);
}
...
}
I also considered making Base an interface, but that doesn't allow me to enforce some argument correctness checks.
Appreciate your help.