private这种modifier只是一种弱约束,runtime下和一般property/method没有任何不同:
object_getInstanceVariable(the_object, "_ivar_name", &the_private_ivar);
这就是Objective-C不需要C++那样引入friend关键字的原因,说到C++ friend关键字还有个经典笑话:
You can't touch my private, but my friends can. 对Objective-C来说就成了: I said you can't touch my private, but if you did touch, I can only say: やめて