Inheritance vs Interface
is happened when we have several classes with similar properties and methods, in this case we can put the similar properties and methods in a new class, and let it be shared between all the classes, in this case I am only have to write the code one time, no need to write it in each class.
when we have several classes with similar methods names(same method name, same method return value type, same method parameters data types), in this case we can make an interface contains the names of these methods, and let the classes share the interface between each other.
total answers (1)
start bookmarking useful questions and collections and save it into your
own study-lists, login now to start creating your own collections.