From the course: Programming Foundations: Object-Oriented Design

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Abstract and concrete classes

Abstract and concrete classes - Python Tutorial

From the course: Programming Foundations: Object-Oriented Design

Start my 1-month free trial

Abstract and concrete classes

- We've defined several different types of spaceships for our game. The starfighter, the cargo shuttle - and the warp cruiser. Weeeee. - And all three of those inherit from the same common superclass called spaceship. We'll use those three subclasses to instantiate objects for each specific type of ship but we'll never actually need to instantiate the generic concept of a spaceship. In this case, spaceship can be defined as an abstract class because it exists purely for the sake of being inherited by other classes to provide some shared behavior but an abstract class itself can never be instantiated because it contains at least one abstract method which is a method that's declared with a method signature but not actually implemented in the abstract class. That's deferred to any subclasses that inherit from the abstract class. They're responsible for actually implementing the abstract methods. In uml diagrams we identify spaceship as an abstract class by using italicized font. Now, not…

Contents