I have the following:
class Parent:
@classmethod
def add_2(cls, number):
plus_1 = cls.add_1(number)
plus_2 = cls.add_1(number)
return plus_2
def add_1(cls, number):
return number + 1
class Child(Parent):
@classmethod
def add_1(cls, number):
return number + 2
Child.add_1(5)
Child.add_2(5)
I want Child.add_2(5) to return 9, but it returns 7. Can anyone explain why this behavior is occurring? Its easy enough to fix it by overriding add_2 as well in the child class, but it seems overly clunky.
@classmethoddecorator forParent.add_1intentional?return plus_1 + plus_2?