Overriding Properties in Subclasses
00:00 Overriding Properties in Subclasses. When you create Python classes that include properties and release them in a package or library, you should expect that your users do a wide variety of things with them.
If you partially override a property, then you lose the non-overridden functionality. For example, suppose you are coding an
Employee class to manage employee information in your company’s internal accounting system. You already have a class called
Person, and you think about subclassing it to reuse its functionality.
Employee works as you need. It returns the name using uppercase letters. However, subsequent tests uncover an unexpected behavior. You may be wondering what’s happened. When you override an existing property from a parent class, you override the whole functionality of that property.
Become a Member to join the conversation.