+ 1

What is the use of this-> ?

28th Nov 2017, 2:33 PM
Vijay
Vijay - avatar
2 Answers
+ 1
Inside a class method, you must use this->, when there is a name conflict. For example, an argument passed in to the method has the same name as a property you need to access. You can use it everytime, if you wish to, to make it obvious you are accessing a property or method of the instance.
28th Nov 2017, 5:06 PM
John Wells
John Wells - avatar
+ 1
Thanks John👍
30th Nov 2017, 12:38 AM
Vijay
Vijay - avatar