Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A:
- def __init__(self):
- self.test = "hmm"
- def A_M(self, change):
- self.test = change
- def getTest(self):
- return self.test
- class B:
- def __init__(self, obj):
- self.obj = obj
- def C(self):
- print self.obj.getTest()
- self.obj.A_M("hello")
- print self.obj.getTest()
- a = A()
- a.B(a).C()
- #a.A_M has been changed to "hello"!
- print a.getTest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement