Inheritance allows you to derive one class from another, and inherit its data and methods. Inheritance is simple in Python.
- [Instructor] Class inheritance is a fundamental part…of object-oriented programming.…This allows you to extend your classes…by driving properties and methods from parent classes.…Here in Komodo, I've opened a working copy…of inheritance.py from chapter nine…of the exercise files.…And you'll notice in our init method,…we're no longer providing any default values.…And that's because this is now just the base class,…and it's going to be inherited in order to be used.…
Because of that, now we need to do a little bit…of extra checking in our setter getters.…We can't just return a value,…we need to check and see if the value's actually there.…And so, I'm using exceptions for this.…This is the normal way to do this.…We're going to cover exceptions in a later chapter.…But just understand that what this does,…is it attempts to return the value,…and if that fails, it returns none instead.…So, to actually use this class,…we're now inheriting it to create other classes.…
We've got a duck class, and a kitten class.…And in each of these cases, we set the type to,…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficientlywith Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.