我想实现一个可以由我的项目的两个类使用的类。在可可类中使用'id'类型
一个是操纵'NewsRecord'对象。 一个正在操作'GalleriesRecord'对象。
在另一类,我可以用两个对象之一,所以我做这样的事情:
// header class
id myNewsRecordOrGalleriesRecord;
// class.m
// NewsRecord and GalleriesRecord have both the title property
NSLog(myNewsRecordOrGalleriesRecord.title);
,我也得到:
error : request for member 'title' in something not a structure or union
任何想法:d?
谢谢。
Gotye
我该怎么做呢?
[myNewsRecordOrGalleriesRecord标题]是伟大的工作;) – gotye 2010-04-20 18:30:21
另外,感谢您的快速和漂亮的答案! – gotye 2010-04-20 18:30:54