A method of the base class calls another method through self.
class Base:
def run(self):
return self.step() * 2
def step(self):
return 1
class Child(Base):
def step(self):
return 5
print(Base().run(), Child().run(), Base.run(Child()))
What does the program print?
Log in to join the discussion.
Loading…