If I have 2 constructors in my custom class, and one of them takes an additional argument and does everything that the first does, but has only one additional line of code (and this extra line uses an additional argument), what is the best way to handle this without need to duplicate all the code in the first constructor?
Code example
public myConstuctor(int number, int number2){ int result = (number + number2); int result2 = (number2 - number1) //Etc //Etc //Etc //Etc } public myConstructor(int number1, int number2, int number 3){ int result = (number + number2); int result2 = (number2 - number1) //Etc //Etc //Etc //Etc int result3 = (result + result2 + number3) }
Zippy source share