A simple hierarchy to learn OOP concepts like Interfaces, Inheritance, Polymorphism, and Abstraction.
This project simulates a zoology system using Object-Oriented Programming (OOP) principles. It demonstrates how real-world entities (like animals) can be represented as classes, with shared characteristics and behaviors defined through interfaces, abstract classes, and inheritance.
The project consists of the following classes and interfaces:
Creature
(Interface): The base interface representing any living creature.Mammal
(Abstract Class): An abstract class implementing theCreature
interface, representing mammals.Cat
(Class): A subclass ofMammal
that implements theCarnivore
interface.Human
(Class): A subclass ofMammal
that implements both theCarnivore
andHerbivore
interfaces.Carnivore
(Interface): Represents creatures that consume meat.Herbivore
(Interface): Represents creatures that consume plants.
+-------------------+
| Creature |
| (Interface) |
+-------------------+
^
|
+-------------------+
| Mammal |
| (Abstract Class) |
+-------------------+
^
|
+-------------------+ +-------------------+
| Cat | | Human |
| (Class) | | (Class) |
+-------------------+ +-------------------+
| - implements | | - implements |
| Carnivore | | Carnivore, |
| | | Herbivore |
+-------------------+ +-------------------+
Your task is to complete the implementation of the classes as described in the hierarchy.
- Clone the repo in your local machine:
git clone <url>
- Open the project in Intellij IDEA or your IDE
- Complete the implementations
- Commit & Push your changes
git commit -m "message"
git push
This exercise is designed to help you understand key OOP concepts by modeling real-world entities. By completing this project, you'll gain a better understanding of interfaces, abstract classes, inheritance, and polymorphism.
Happy coding! 🚀