obj-c2[instance variable visibility and method]

Source: Internet
Author: User

////setterMethod  The setting device,a method that assigns a value to an instance variable specifically
//-(void) SetName: (NSString *) name;
//-(void) Setage: (Nsinteger) age;
//-(void) Setsex: (NSString *) sex;
//-(void) Setweight: (cgfloat) weight;
//-(void) SetHeight: (cgfloat) height;
//
////getterMethod Accessors,a way to get the contents of an instance variable
//-(NSString *) name;
//-(NSString *) sex;
//-(Nsinteger) age;
//-(cgfloat) weight;
//-(cgfloat) height;

//[Method Name]changername:age:sex:weight:height:
//determine a method name

// Span style= "font-style:normal;font-variant:normal;font-weight:normal;font-family: ' Heiti SC light ';" > Remove the return value type remove formal parameter type and formal parameter name

//oc no duplicate definitions are allowed

//+ Span style= "font-style:normal;font-variant:normal;font-weight:normal;font-family: ' Heiti SC light ';" > You can only call with the class name

//+ instance variables cannot be used in the number method , because there's no object created at all , Memory Store Instance variable only if object is created ;


+ (void) testmethod{
NSLog (@ "Hello");
////NSLog (@ "Hello%@", _name);// of the wrong

//}

// The initialization method is used only once in the life cycle of an object


//ifAclass. hintroducedBClass of. hfile, Bclass and introduceAheader file for class,causes the header file loop to introduce errors
//Solution Solutions:

//There are only two cases that need to be. hthe introduction of other header files inside, 1is inherited, 2is the agreement.requires a header file except for the secondary,All to. Mreferenced in file. hIf you want to use this type in the,Use@classKey Words, @classThe function is to tell the compiler that it is a type,does not introduce the contents of this file.


This article is from the "ios--Training" blog, so be sure to keep this source http://zys2007.blog.51cto.com/8207599/1602682

obj-c2[instance variable visibility and method]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.