OC self注意事项
2015-12-10 14:25
337 查看
#import <Foundation/Foundation.h> @interface Person : NSObject - (void)test; + (void)test; - (void)test1; + (void)test2; - (void)haha1; + (void)haha2; @end @implementation Person - (void)test { NSLog(@"调用了-test方法"); // 会引发死循环 //[self test]; } + (void)test { NSLog(@"调用了+test方法"); // 会引发死循环 //[self test]; } - (void)test1 { [self test]; // -test } + (void)test2 { [self test]; // +test } - (void)haha1 { NSLog(@"haha1-----"); } void haha3() { } + (void)haha2 { // haha3(); [self haha3]; // [self haha1]; } @end int main() { [Person haha2]; //Person *p = [Person new]; //[p test1]; return 0; }
相关文章推荐
- MAC版Eclipse的常用快捷键
- Apache编译与安装 RedHat enterprises 6.2
- 木已成粥
- eclipse自动把参数arg0、arg1改为req、res
- log4j使用及详解
- HTML5创建线条渐变
- C#实现网段扫描
- EditText的inputType属性
- IOS:dispatch_group_enter的学习
- JSON序列化与反序列化DataSet
- LVM 逻辑卷管理工具详细教程:
- 在IT在系统中使用多租户技术的跨部门和虚拟团队的解决方案为员工提供(草案)
- setOnItemSelectedListener、setOnItemClickListener与setOnTouchlistener的区别
- Android特效Toast详解
- Apache Stratos探究:概念--cloudburst和Hybrid Cloud
- mac中.so和.dylib库解释--记录
- leetcode:292 Nim Game-每日编程第一题
- 【JavaScript 从零开始】 语言核心部分----可选的分号
- Integer to English words leetcode java
- 为什么存储密码字符数组比字符串更合适? 有点意思