3 ms·
Inheritance is a great way to allow your newly defined class to interface with the language syntax or system environment features in a useful way. Doing somethi
by probinso 9y ago
Inheritance is a great way to allow your newly defined class to interface with the language syntax or system environment features in a useful way. Doing something like inheriting from a dictionary in Python allows for you to extend a very versatile tool that already exists, that has been optimized for use in the language.
If you are going to bother inheriting from a class, then you should weigh the cost of your code complexity against it. It is definitely worth it sometimes
If you wrote both the class and sub-class, then you're likely over engineering the problem (unless you have a sufficiently large program you're working on)