Pls refer to the given below program:
The result is :
0
1000
2000
And when called explicitly :
gives us
10
1000
2000
Code:
class t2: a=0 def _init_(self): t2.a=10 def f1(self,temp): self.a=temp def f2(self): print self.a O1=t2() O1.f2() O1.f1(1000) O1.f2() O1.a=2000 O1.f2()
0
1000
2000
And when called explicitly :
Code:
class t2: a=0 def _init_(self): t2.a=10 def f1(self,temp): self.a=temp def f2(self): print self.a O1=t2() O1._init_() O1.f2() O1.f1(1000) O1.f2() O1.a=2000 O1.f2()
10
1000
2000
Comment