Join Jungwoo Ryoo for an in-depth discussion in this video Working with inheritance and polymorphism, part of Python: Design Patterns.
- There are some additional key concepts to master…in object oriented programming.…We'll get started with inheritance.…Inheritance establishes this relationship between…two classes as parent and child.…The child class keeps all the attributes and methods…of its parent.…It can also add new attributes or methods…of its own to its definition.…The child class can also override…the existing methods of its parent.…
For example,…let's say that we have this pet class…which has two child classes,…one which is the dog class,…and then the other which is the cat class.…Both of these child classes…share the common attribute…which is the name attribute…they're inheriting from the pet class.…However, the child class is override…their speak methods in their definition.…For example, the dog class overrides…his speak method to produce the barking sound,…while the cat class overrides the same method…to produce the meow sound.…
Another object orientated class set…important to understand is polymorphism.…Polymorphism relies on inheritance…
- Understanding design patterns
- Best design practices: consistency, completeness, and correctness
- Working with creational patterns
- Working with structural patterns
- Working with behavioral patterns
Skill Level Intermediate
Q: In the strategy pattern example, why does the code keep executing the default function rather than the alternate?
A: The programming demonstration skips the step of defining what the strategy pattern should be when an alternate function name is provided
as an argument as shown below.
1. Understanding Design Patterns
2. Creational Patterns
3. Structural Patterns
4. Behavioral Patterns
5. Design Best Practices
- 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.