Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
A type diagram is a visual representation that shows the relationships between different types of objects in a program. It helps programmers understand how classes and interfaces are related to each other.
Inheritance is when one class inherits properties and behaviors from another class. For example, if we have a "Vehicle" class and a "Car" class, the "Car" class can inherit properties like "color" and behaviors like "drive" from the "Vehicle" class.
An interface is like a contract that defines what methods an object must implement. It specifies the method signatures but not their implementations. For example, we can have an interface called "Drawable" that defines the method "draw()", and any class implementing this interface must provide its own implementation of the "draw()" method.
Abstract Class: An abstract class is similar to an interface but can also include implemented methods. However, it cannot be instantiated directly; it serves as a blueprint for other classes to inherit from. Abstract classes allow us to define common behavior while leaving some details to be implemented by subclasses.