Can someone help me understand the python 's lesson (inheritance) ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone help me understand the python 's lesson (inheritance) ???

15th Jan 2022, 9:29 PM
Aziz Marouani
Aziz Marouani - avatar
2 Answers
+ 3
Class Inheritance is a way to extend a class. The new class (child class) builds or overwrites logic from the parent class (super class). Overwritten method is a method that has been inherited from the parent but it's logic is changed in the child. Syntax for overwriting function: class ParentClass: def funcName(args): # code ​ class ChildClass (ParentClass): def funcName(args): # overwriting function A child's class constructor can call parent's class constructor via the super keyword. ___________________ Source ___________________ Coding Champ
15th Jan 2022, 9:57 PM
Chigozie Anyaeji 🇳🇬
Chigozie Anyaeji 🇳🇬 - avatar
+ 1
Hey thanks bro
16th Jan 2022, 1:14 PM
Aziz Marouani
Aziz Marouani - avatar