CodePudding user response:
1the static method2 create a class, write the method
CodePudding user response:
The same logic code extraction, abstraction, separate written public methods class libraries, other classes to invoke the public methods class library,Complex scenarios may need to design class, the inheritance of the interface,
CodePudding user response:
Put the same code in a class, the rest of the class the class inheritanceCodePudding user response:
In a way outCodePudding user response:
Can put the same code into a method, which can implement code reuse, reduce code redundancyCodePudding user response:
Write your methods in a classAnd then where do you want this method