Self Object

[Solved] Self Object | Php - Code Explorer | yomemimo.com
Question : self object

Answered by : apoorv-shrivastava

class A: def a(self,st): return 1 def b(self,s1,s2) : d= self.a(7) return d
obj=A()
print(obj.b(1,2))
//prints 1
// so basically every function in a class have self which is object
// like in each of them self is there -- def a(self,st): & def b(self,s1,s2):
// used to other functions of that class and
//it's used to call other functions & while calling that other function
// we don't write self inside it
// d= self.a(7)

Source : | Last Update : Wed, 16 Mar 22

Answers related to self object

Code Explorer Popular Question For Php