Hi i am having some trouble passing variables/doing functions from other classes,
Right now I have something like this,
class 1(3):
def hi():
print 'class 1'
class 2(3):
def hi2():
print 'class 2'
class 3:
def hi3():
print 'class 3'
Lets say, from class 1 I would like to execute a function from class 2, How can I go about doing this?
I have been Googling this for awhile, and haven’t had much success (except for finding images of snakes)
Any help with this problem would be greatly appreciated
if class 3 needs functions from both class 1 and class 2 you could do a double inheritance:
then any object that is created of class three will be able to call funct1, funct2, and funct3. Also this object will have it’s own version of self.data1, self.data2, and self.data3.
prints ‘one’
prints ‘I am defined in class one’
Now, on the other hand, if you want a function of a sub-class to call a method of a superclass, that can be done:
prints ‘class one’
hope this helps!