0
Can someone help me understand the python 's lesson (inheritance) ???
2 odpowiedzi
+ 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
+ 1
Hey thanks bro