self in lens C

Possible duplicate:
Should I use my own keyword (properties) in the implementation?

Say I have a class "Man", with an instance variable "age". Based on Python, when writing methods for the Person class, I’m used to referring to age using self.age, however, it was noted in Objective CI that both self.age and age are accepted when accessing an instance variable (whereas only the first one will work in Python).

If you do not explicitly state which instance variable you mean, is it the default self? And is it considered a bad style not to explicitly define yourself? If not, are there agreements on when to use self.age and when to use age?

+3
source share
2 answers

self , . self.age, age, @property. self , .

0

All Articles