a.doit(): Calls doit on the instance a of Sub_A. Since Sub_A overrides make, a.make() returns 1.
b.doit(): Calls doit on the instance b of Sub_B. Since Sub_B does not override make, b.make() returns 0 (inherited from Super).
A is correct
class Super:
def make(self):
return 0
def doit(self):
return self.make()
class Sub_A(Super):
def make(self):
return 1
class Sub_B(Super):
pass
a = Sub_A()
b = Sub_B ()
print(a.doit() + b.doit())
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
kostadiv
1 month agokostadiv
1 month agoHorsefeathers
2 months, 3 weeks agoDave304409
9 months, 3 weeks agoDKAT2023
9 months, 3 weeks ago