Q. What is the output of class A: x = 5 class B(A): x = 10 print(B().x)?
Solution:
B overrides x, so B().x returns 10, the child’s attribute.
Get Question Bank
Strengthen Your Practice with our comprehensive question bank.
B overrides x, so B().x returns 10, the child’s attribute.
Strengthen Your Practice with our comprehensive question bank.