"Hello, Amigo! Here I am. And I've brought you ... a big and interesting task about multiple inheritance."
undefined
3
Task
Java Core,
level 3,
lesson 6
Locked
Tom, Jerry and Spike
Use class and interfaces to implement the relationship between Tom, Jerry and Spike the Bulldog. The cat can move, eat, or be eaten. The mouse can move and be eaten. And the dog can move and eat (whoever it wants!).
It is SOOOOooooo overcomplicated ?
Sorry, I know I am complaining, and still a newbie in Java. But why not simplify it and use methods ?
eat(), move(), etc.
Alright, from the preceding topics what i conclude about:
Abstraction - is that it is used to create an idea of a system of classes, where we can make fundamental methods that the inheriting class can implement in its own way and we can also define implemented methods that are already common in all the derived classes
Interfaces - is much like abstraction but is used to define roles/methods that specific classes can implement in their own style and it is through these roles, using the mechanism of abstraction and polymorphism, we interact with objects of other classes.
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.
GO TO FULL VERSION