- 1

SELF

what is the use of "self " in classes, how does that help while calling an object method?

14th Mar 2021, 6:24 PM
EBBY
5 Answers
+ 1
Hey there EBBY, Please add some more info at your question as the programming language. Thanks :) https://www.sololearn.com/blog/38/8-simple-rules-to-get-help-from-the-community https://www.sololearn.com/Discuss/333866/?ref=app
14th Mar 2021, 6:27 PM
Matthew
Matthew - avatar
0
'self' in class usually refer to the instance it-self... usually, because you could name it as you want (unless the name identifier is valid)... but I would not advice to use another name ;P
14th Mar 2021, 7:46 PM
visph
visph - avatar
0
Hi how we can have n number of reference variable for an object pls explain
26th Mar 2021, 8:23 PM
EBBY
0
EBBY you could store how many reference variable for any object you want... just assign an object to many variables ^^ SELF, or as you want to name it in Python, is just the basic way to refer to the current object from its class method... in javascript you're required to use the 'this' object, without having the possibility to change its name, as for others languages ^^
26th Mar 2021, 8:29 PM
visph
visph - avatar
- 1
Reference variable is like a TV remote Lost the 1 remote Bought another 1 Found the lost one Now I have 2 I can use either of them U can use n number of remotes to control the T V PLS EXPLAIN the logic
30th Mar 2021, 3:18 PM
EBBY