The child class would have to inherit the parent self attribute to do that.
class Animal:
def __init__(self, name):
self.name = name
class Mammal:
def Presentation(inherit):
print(inherit.name + "is a mammal")
dog = Animal("Dog")
Mammal.Presentation(dog)
Jacob Lee
- 4.7k
- 2
- 20
- 40