0
Please, explain inheritance in a simple way
3 Respuestas
+ 1
class A:
def __init__(self):
self.value = 5
def hello_msg(self):
print("Hello!")
class B(A):
def __init__(self):
super().__init__()
# calls to A's method and B's inherited method
A().hello_msg()
B().hello_msg()
# output
Hello!
Hello!
- 1
Class A
Def method (self)
Print (1)
Class B
Def method (self)
Print(2)
B(). Method()
do it