OC, oc Language

Source: Internet
Author: User

OC, oc Language

I. Basic syntax

1> OC language and C Language

  • C is a process-oriented language, and OC is an object-oriented language.
  • The OC language inherits the C language and adds the object-oriented idea.
  • The following describes only the differences between the OC language and the C language.

2> keywords

  • Start with a letter or underscore

3> string

  • The OC language has its own unique string, which is different from the C language string.

4> BOOl type

  • Only YES and NO values are available.
  • It is essentially a char type, but is interpreted as an integer.
  • The BOOL type is introduced by the Conditional compilation mechanism.

5> # import and # include

  • Both copy the file content to the code line that appears in the command.
  • System files are enclosed in angle brackets and user-defined files are enclosed in parentheses.
  • # Conditional compilation commands are included in the import file to prevent the file from being copied multiple times.

6> NSLog and printf

Ii. Classes, objects, and methods

1> class

2> Object

3> Method

 

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.