Lesson 12: super() — extending the constructor
What if the child has extra data the parent lacks — a dog's breed, say? It gets its own __init__, but we don't copy the parent's: we call it with super().__init__(...) and add only what's new. True reuse, zero duplication.
super() is a direct line to mom: "you handle your parts (the name), and I'll add mine (the breed)".
- super()
- Calling the parent class from within the child — mainly super().__init__(...) to run the parent's constructor.
- extending a constructor
- A child constructor that first calls the parent's constructor and then adds its own new attributes.