Learning notes 01-objective-c Overview

Source: Internet
Author: User
I. Introduction 1. C Language

C language is a process-oriented language. OC adds the smallest object-oriented syntax based on C language. Why is it the smallest object-oriented syntax? Because OC removes some complex object-oriented syntaxes, and the rest are the essence of object-oriented, OC is an object-oriented language, it is much simpler than C ++. Because the OC is based on the C language, it is fully compatible with the C language. That is to say, we can mix the C language code into the OC code During IOS program development, or even the C ++ code.

2. Role

We can use OC to develop Mac OS X and iOS applications.

Here is a brief description of Mac OS X and IOs:

  • Mac OS X is the exclusive operating system developed by Apple for Mac products. Currently, the operating system is equipped with devices such as MacBook, iMac, and Mac Mini.
  • IOS is a handheld device operating system developed by Apple. Currently, devices equipped with this operating system include iPhone, iPad, iPod Touch, and iPad Mini.
3. Popularity

Below is the top ranking of programming languages in March 2013

Compared to the 2012 S, the popularity of OC increased by 2

 

Ii. Syntax preview 1. No package name (namespace) Concept

In Java, to prevent conflicts between classes with the same class names, you can place these two classes in different packages. There is no "package" concept in OC, that is, there is no namespace mechanism. Instead, developers Add a prefix to the class name, which effectively prevents class name conflicts. For example, nsstring (string class in OC) and nsarray (array class in OC), whose prefixes are NS

 

2. All keywords start @

1> As I mentioned earlier, OC code can be mixed into C and C ++ code, while C and C ++ both have their own keywords as a programming language. To prevent conflicts with the C language and C ++ keywords, the OC keywords all start.

The following lists some common keywords. You can just take a look at them. You don't have to go over the information to find their meanings.

@ Interface, @ implementation, @ end @ public, @ protected, @ private, @ selector @ try, @ catch, @ throw, @ finally @ protocol, @ Class // The New keywords introduced in OC 2.0 include @ property, @ synthesize @ optional, @ required, @ dynamic

2> even strings start with @. For example, @ "hello" is a string in OC, while "hello" is a string in C.

 

3. Key Points of syntax

Learning notes 01-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.