Tuesday, June 14, 2011

Private and Public Variables in Objective-C




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


        @protected      
        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.

        @public
        int publicVar;  // Can be accessed by any object,view
    }
    @end







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

7 comments:

  1. I am so happy to found your blog post because it's really very informative. Please keep writing this kind of blogs and I regularly visit this blog. Have a look at my services.
    Cyber Security Training Course in Chennai | Certification | Cyber Security Online Training Course | Ethical Hacking Training Course in Chennai | Certification | Ethical Hacking Online Training Course | CCNA Training Course in Chennai | Certification | CCNA Online Training Course | RPA Robotic Process Automation Training Course in Chennai | Certification | RPA Training Course Chennai | SEO Training in Chennai | Certification | SEO Online Training Course

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Great collection! Thank you so much for sharing this valuable information with us. Your effort in curating and presenting these details is truly appreciated. fullstacktrainingcenter

    ReplyDelete