摘要: self和super的区别#import 首先先写两个类 fist和two,two继承fist类@interface First:NSObject{ int a;//声明了一个变量}-(void) setA:(int)c;//对a赋值的方法@end@implementation First-(void)setA:(int)c{ a=c;}@end//类2@interface Two : First{ int b;}-(void)setB:(int)d;-(void)print;@end@implementation Two-(void)setB:(int)d{ b=d;}-(void)... 阅读全文
posted @ 2013-07-14 22:22 火红的云彩 阅读(837) 评论(0) 推荐(0) 编辑
摘要: 1.在我们平时些程序中我们经常需要一些变量的他们能纪录我们所需要的值,但是平常的int类型达不到这样的目的,所以呢就有了static的基态变量,静态变量就像 B/S中的session,cookio等,2.编写一个简单的程序记载函数被调用了多少次int pagecount(){ static int count=0; count++; return count;}下面我们从main()函数中调用 pagecount(); pagecount(); pagecount(); pagecount();NSLog(@"pagecount函数被调用了%d次",pagecoun... 阅读全文
posted @ 2013-07-14 15:46 火红的云彩 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 1.类的声明 @interface Xiao:NSObject //l类的声明用interface 类名:NSObject ,在oc中所有的类都继承NSObject-(void)Round; //这个只声明函数的名,返回之类型,参数2.类的是实现方法@implementation Xiao //类的调用implementation 类名-(void) Round //函数的实现{ NSLog(@"我爱你,就像老鼠爱小猫咪!!!");} 阅读全文
posted @ 2013-07-14 15:36 火红的云彩 阅读(223) 评论(0) 推荐(0) 编辑