What exactly does self do?


#1

Can anyone explain this as simply as possible?


#2

self is used to set an instance/class method


#3

self is a local representation of the instance object, scoped to the execution context. Which ever instance is calling a method or accessing a property, that instance is locally referred to by self. This is how many instances can use the one class template.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.