[Tutor] How can I access a variable outside a class definition?
by A other posts by this author
Sep 29 2001 7:10PM messages near this date
[Tutor] Informacion de Interes
|
Re: [Tutor] How can I access a variable outside a class definition?
Hi,
How can I access a variable defined in one class outside this class
? For example
I have two classes like below
#############################
class Complex:
def __init__(self, realpart1,imagpart1,realpart2,imagpart2):
self.r1 = realpart1
self.i1 = imagpart1
self.r2 = realpart2
self.i2 = imagpart2
def Add(self,r1,i1,r2,i2):
self.sum=self.i1+self.i2
ImSum=self.sum
return ImSum
###########################
###########################
class Outside
def MyFunction(self,ImSum)
...
...
########################
Is it possible to access,in the Outside class, a value of
the ImSum
that was return by
Add function in that Complex class?
Thank you for help.
Ladislav
_______________________________________________
Tutor maillist - Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
|