From the course: Python Quick Start
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Applying object-oriented programming - Python Tutorial
From the course: Python Quick Start
Applying object-oriented programming
What if you want to use object oriented programming to represent the different characteristics and behaviors of different dogs? How would you go about this? There are more concepts in object oriented programming that allow you to create such representations. Diving deeper into OOP will help you understand the power of OOP and what you can accomplish with it. In this lesson, I'm going to show you inheritance and method overwriting so you can implement these concepts as you program in Python. Inheritance allows programmers to create a hierarchy in which each class inherits the methods and the data attributes from the classes above it in hierarchy. For example, say you want a dog class, a poodle class that inherits from the dog class and a corgi class that also inherits from the dog class. Here's one way you can approach this. First, start by defining the dog class along with its initialization function. The attributes, name and age which are defined in the initialization function…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.