could somebody explain me why this prints out 2 and not 3? i would thing that __var class variable would be overrided in Class Bottom with the value 3 and when the get method (inherited from class Middle) gets called, it would print out the overridden __var equals 3:
class Top:
__var = 1
def get(self):
return self.__var
class Middle(Top):
__var = 2
def get(self):
return self.__var
class Bottom(Middle):
__var = 3
obj1 = Top()
obj2 = Middle()
obj3 = Bottom()
print(obj3.get())