Use of type 'id' in cocoa class

Posted by gotye on Stack Overflow See other posts from Stack Overflow or by gotye
Published on 2010-04-20T17:54:06Z Indexed on 2010/04/20 18:13 UTC
Read the original article Hit count: 257

Filed under:
|
|

Hey guys,

I want to implement a class which can be used by two classes of my project.

One is manipulating 'NewsRecord' objects. One is manipulating 'GalleriesRecord' objects.

In another class, I may use one of the two objects so i do something like that :

// header class
id myNewsRecordOrGalleriesRecord;

// class.m
// NewsRecord and GalleriesRecord have both the title property
NSLog(myNewsRecordOrGalleriesRecord.title);

and i get :

error : request for member 'title' in something not a structure or union

any ideas :D ?

Thanks.

Gotye

How am I supposed to do it ?

© Stack Overflow or respective owner

Related posts about header

Related posts about properties