OBJECTIVE-C----First knowledge of objective-c

Source: Internet
Author: User


First knowledge of Objective-c


When Objective-c was first born, the extension. m stands for message, which refers to a major feature of Objective-c.


NSLog (@ “% d”, 12); // can output 12
printf ("% d \ n", 23); // can output 23
NSLog (@ "% s", "abc"); // Can output string abc
printf ("% s", "abc"); // print string abc 


The programming style of "data first, function second";



Following the open/closed programming principle, when encapsulating a class, we can extend it without modifying the internal implementation.



Bugs are nowhere to hide unless the code is streamlined.



OC does not allow initialization of member variables in the interface (interface).



The interaction between all objects in the objective-c is accomplished by pointers.



Example: (will report an error)

If you do file extensions with. mm, the compiler will think that you are writing code with objective-c++, so you can use both C + + and objective-c to program.



OBJECTIVE-C----First knowledge of objective-c


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.