From the course: Programming Foundations: Object-Oriented Design

Unlock the full course today

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

Identifying inheritance situations

Identifying inheritance situations - Python Tutorial

From the course: Programming Foundations: Object-Oriented Design

Start my 1-month free trial

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 identify if it's inheritance, is with two simple words, is a…

Contents