Tuesday, June 14, 2011

Private and Public Variables in Objective-C

    @interface MIMClass : NSObject
        int _privateVar; //BY convention I usually put _ in front of private variables.

        int _myVar; //By default, every variable you define is in protected mode so if you don't          write protected above your variables, they are by default in protected mode.

        int publicVar;  // Can be accessed by any object,view

I guess the code above pretty much explains how you can declare the private and public members in Objective-C

No comments:

Post a Comment