ios - What does 'friend' do in Obj c? -


this question has answer here:

i'm working on project have created class named friend , noticed xcode colors keyword or modifier. can use did in code, or has other purpose?

enter image description here

updated: seems answered here:

why xcode ide think `friend` reserved-word

but guys!

c++ provides friend keyword this. inside class, can indicate other classes (or functions) have direct access protected , private members of class. when granting access class, must specify access granted class using class keyword:

friend class aclass;

note friend declarations can go in either public, private, or protected section of class--it doesn't matter appear. in particular, specifying friend in section marked protected doesn't prevent friend accessing private fields.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -