redeclared as different kind of symbol ,undefined reference to `__objc_class_name_Rectangle12'

||=== RTest, Debug ===|
D:\workspace\IOS\RTest\main.m|3|error: 'Rectangle' redeclared as different kind of symbol|
d:\app\ios\gnustep\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\wingdi.h|2956|error: previous declaration of 'Rectangle'|
D:\workspace\IOS\RTest\main.m|16|error: 'Rectangle' redeclared as different kind of symbol|
d:\app\ios\gnustep\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\wingdi.h|2956|error: previous declaration of 'Rectangle'|
D:\workspace\IOS\RTest\main.m||In function 'main':|
D:\workspace\IOS\RTest\main.m|41|error: 'myRect' undeclared (first use in this function)|
D:\workspace\IOS\RTest\main.m|41|note: each undeclared identifier is reported only once for each function it appears in|
D:\workspace\IOS\RTest\main.m|41|warning: invalid receiver type '' [enabled by default]|
D:\workspace\IOS\RTest\main.m|41|error: cannot convert to a pointer type|

||=== Build finished: 7 errors, 1 warnings ===|


类名重复,如果自己写的类名没有重复,则可能是根系统函数冲突.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

obj\Debug\main.o:main.m:(.data+0xb4)||undefined reference to `__objc_class_name_Rectangle12'|

错将Rectangle12.m引入成了Rectangle12.h


接口和实现类分

好像OBJ-C里的实现好像不跟JAVA一样,是单实现的,因为不可以给实现类写名字(或许是我没有发现).


其实也不算,这里面可以@interface A:NSObject

@interface B:A

@implementation B

{

//code here

}


@interface C:A

@implementation C

{

}

@interface D:B

@implementation D

{

}

------------------------------------------------------------------------------------------

ok,这好像是所谓的分类(categroy)机制

允许以模块方式向现有类定义添加新方法,也就是,不必经常给同一接口和实现文件增加新定义.当想要对你没有源代码访问权限的类添加新定义时,这特别方便.(分类和协议)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值