I have someting like this
class A:
__a = 0
def __init__(self):
A.__a = A.__a + 1
def a(self):
return A.__a
class B(A):
def __init__(self):
# how can I access / modify A.__a here?
A.__a = A.__a + 1 # does not work
def a(self):
return A.__a
Can I access the __a
class variable in B
? It's possible writing a
instead of __a
, is this the only way? (I guess the answer might be rather short: yes :)