java - Calling an overloaded method -
how create overloaded method same plus new functionality? without copying same code again.
something this:
void method(){ //code 1 } void method(string s){ //code 1 //code 2 }
try refactor mutual code private method:
void method(){ common(); } void method(string s){ common(); //code 2 } private void common() { // code 1 }
java overloading
No comments:
Post a Comment