- @interface @end and @implementation @end cannot be nested with
- Only the declaration of the class has no implementation of the class
- Leakage @end
- Declaration nesting of two classes (can be broken sequentially)
- Member variable not written in {}
- The declaration of the method wrote {} inside
- Initialize the member variables of the class when declaring, and note that member variables cannot exist independently from the object
- Method cannot be called as a function
- Member variables and methods cannot be modified with keywords such as static, not confused with C language
- The implementation of the class can be written behind the main function and can be used as long as there is a declaration
OC objects are fundamentally different from functions:
- The implementation of the method can only be written in the @implementation @end, and the Declaration of the object method can only be written in the middle of @interface @end
- Object methods begin with--the class method starts with the + sign
- Object methods can only be called by an object, class methods can only be called by a class and cannot be called as functions
- Functions belong to the entire file, can be written anywhere in the file, including @implementation @end, but written in @interface @end will not be recognized, functions can be declared inside the main function can also be outside the main function
- Object method collation \ Object All
- function calls do not depend on the object
- The member variable of an object cannot be accessed directly inside a function by a member variable name
OC Language Basics 2