- 1
SELF
what is the use of "self " in classes, how does that help while calling an object method?
5 ответов
+ 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
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
0
Hi how we can have n number of reference variable for an object pls explain
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 ^^
- 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