[Tutor] Inheritance
arkamir at softhome.net
arkamir at softhome.net
Tue Dec 16 15:34:17 EST 2003
I'm just starting to learn classes and have run into trouble understanding
how classes inherit.
One question is if class A inherits from class B and C. And then B inherits
from M and N. And C inherits from F and G, while F and N inherit from class
z which inherits from object, what is the name resolution.
Z
M N F G
B C
A
Also can someone explain to me what super() does, i need something pretty
basic.
Next using the same classes as above, if z.__init__: connects to a database,
how can I make sure that it is only called once, while initializing all the
classes. Would the connection have to be just within the body, and how would
that work??
class test:
def __init__():
self.x = 'hello'
print self.x
Tha above code raises an error. What can I do to make it work??
More information about the Tutor
mailing list