Objective-C's magic path [1-objective-c features]

Source: Internet
Author: User

Do not repost the labor results of developers


Objective-C is obviously different from other object-oriented systems.
The following describes the features of this method: compatibility, word
String, class, method, attribute, protocol, and classification.

1. Compatibility
Objective-C is an object-oriented C language. In objective-C code, there can be C and C ++ statements,

It can call C functions or access methods through C ++ objects.


2. String
Objective-C generally does not use a C-language string.

In most cases, it is a string of the nsstring type that uses the foundation framework.

The nsstring class provides string class packaging and supports Unicode and printf-style formatting tools.

It places a @ symbol before a regular double quotation mark string,

The following is an example:

NSString* myString = @"My String\n";NSString* anotherString = [NSString stringWithFormat:@"%d %s", 1, @"String"];

3. Class
Objective-C is an object-oriented language, and defining a class is its basic capability.
The class description and implementation of objective-C include the Interface part and the implementation part.

4. Method
Objective-C is an object-oriented language, and the definition method is also its basic capability.
In objective-C, the method uses the [] operator instead of the "." operator.

Sometimes a method call is also called message sending.


5. Attributes
Attribute is a concept proposed by objective-C 2.0,

It is an alternative to the "Getter" and "setter" methods for accessing member variables,

To encapsulate a class, you can access the class through attributes instead of directly accessing the member variables.


6. Agreement
The protocols in objective-C are similar to interfaces in Java or pure virtual classes in C ++,

Only some interface definitions are not implemented, that is, only the H file does not have m files.

7. Classification

In objective-C, categories are similar to inheritance mechanisms, and can be used to extend the features of parent classes.

Objective-C's magic path [1-objective-c features]

Related Article

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.