Inheritance Python Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Inheritance Python Question

What is the result of this code? class A: def method(self): print(1) class B(A): def method(self): print(2) B().method()

16th Mar 2020, 10:56 AM
Ethan Youngman
Ethan Youngman - avatar
2 Answers
+ 3
The B class inherits class A but overrides the method method() It's answer is 2
16th Mar 2020, 10:58 AM
ใ‹ใ‚“ใงใ‚“
ใ‹ใ‚“ใงใ‚“ - avatar
0
answer is 2
24th Jul 2021, 8:43 AM
Judson Leo
Judson Leo - avatar