问题
I have an external library in the project:
The project uses methods from this library
For me, the classes in this library are read-only
I need to change the method logic from an external library a little bit
What and how should I do?
Maybe I should create new class in project with the same logic? (+ my changes)
Maybe other solutions?
回答1:
If you use Kotlin
you could use Extension Function
to extend class functionalities with no need to extend
it. You use Java
you could extend the classes and override
or add
methods to it. There is no need to copy/paste class to add new functionalities.
来源:https://stackoverflow.com/questions/58396869/editing-an-external-library