Question #298

What is the output of the code snippet below?
class A(object):
    x = 1

class B(A):

class C(A):

B.x = 2
A.x = 3
print(A.x, B.x, C.x)

In this case, when x changes for A , it also changes for C as C inherits from A and x is not specifically declared in A . (

Comment on Disqus:

Comment on Twitter:

Question difficulty: πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅