0
Inheritance question
I don’t understand why the answer to this code is 2, not 3 class A: def a(self): print (1) class B(A): def a(self): print(2) class C(B): def c(self): print(3) c = C() c.a()
3 ответов
+ 2
Because you are not overriding a() in class C. That is c() in class C. So it will print the one which is inherited from class B and the value is 2.
0
The answer is 2
- 1
What is the result of this code?
class A:
def a(self):
print(1)
class B(A):
def a(self):
print(2)
class C(B):
def c(self):
print(3)
c = C()
c.a()
ans:2