From the course: Programming Foundations: Object-Oriented Design
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Identifying inheritance situations - Python Tutorial
From the course: Programming Foundations: Object-Oriented Design
Identifying inheritance situations
- Inheritance is one of the four key concepts of object orientation. It allows one or more classes to inherit the attributes and methods of another class, referred to as the parent or superclass. The inheriting subclasses or child classes automatically have all of the attributes and methods of their parent class. And they can have their own unique attributes and methods in addition to those. The advantages of code reuse and code maintenance make inheritance a really powerful tool if you can recognize when to use it. - Hey, Baron. I've been designing different types of space ships for a video game. I've got a star fighter that can shoot missiles at a player. - Mm-hmm. - And a cargo shuttle that carries, well, cargo. If the player asteroid's smashes into the cargo shuttle, it acts like a pinata that drops power ups into space. - Ha, cool. Well I sense there's some sort of relationship going on here, and the best way to…
Contents
-
-
-
-
-
-
-
-
(Locked)
Identifying inheritance situations4m 55s
-
(Locked)
Using inheritance2m 44s
-
(Locked)
Abstract and concrete classes3m 10s
-
(Locked)
Interfaces4m 15s
-
(Locked)
Aggregation2m 3s
-
(Locked)
Composition1m 45s
-
(Locked)
Challenge: Jukebox class relationships1m 6s
-
(Locked)
Solution: Jukebox class relationships3m 17s
-
(Locked)
-
-
-