Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo():
- def __init__(self, a):
- self.a = a
- def forward(self, x):
- x = self.__apply(x)
- return x * self.a
- def __apply(self, x):
- x = x * 2
- return x
- class Bar(Foo):
- def __apply(self, x):
- x = x * (-2)
- return x
- clas = Bar(1)
- clas.forward(1) # вернется 2, а я хочу -2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement