Objective C Overview

Source: Internet
Author: User

Syntax overview

1. There is no package name (namespace) concept in Java, in order to prevent two class names with the same class conflict, you can put these two classes in different packages. There is no concept of "package" in OC, that is, there is no namespace mechanism, instead the developer prefixes the class name and uses the prefix to effectively prevent class name collisions. For example, NSString (the String class in OC), Nsarray (an array class for OC), and their prefixes are NS 2. The keywords all start with @ 1> I said earlier that the OC code can be mixed with C language, C + + code, The C language and C + + as a programming language, have their own keywords. To prevent conflicts with C and C + + keywords, the OC keyword begins with @. Some common keywords are listed below.
@interface, @implementation, @[email protected], @protected, @private, @selector @try, @catch, @throw, @finally @protocol , the new keywords introduced in @class//OC 2.0 are @property, @synthesize @optional, @required, @dynamic

2> even strings are preceded by @, such as @ "Hello" is the OC Red string, and "Hello" is a string in C language.

3. Key points in grammar

Objective C Overview

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.