This class diagram contains three subclasses: Duck, Fish, Horse, and one superclass: Animal. Each subclass is connected to the Animal superclass with an inheritance relationship.

unnamed.png

Edit this diagram in Gleek

Animal inheritance diagram code in Gleek

Animal
+int age
+string gender
+isMammal ()
Fish
-boolean canEat
-swim()
Horse
+boolean isWild
+run()
Duck
+string color
+swim()

Duck–*>AnimalAnimal

About class diagrams

Class diagrams are used in software engineering to describe the structure of a system. A class diagram uses Unified Modeling Language (UML) to show the classes, attributes, methods (or operations), and their relationships to each other in the system. Class diagrams prove valuable in object-oriented modeling. Class diagrams can be used to model the data structure or to design a system in detail.

Similar class diagram examples

Library management system class diagram

Order processing system class diagram

Hotel management system

Railway reservation system

Course registration system class diagram

Passport automation system class diagram

Movie enumeration class diagram

ATM system class diagram