Q:

what is the difference between Inheritance and Interface

0

Inheritance vs Interface

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Inheritance:

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.

 

Interface:

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.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now