Objective-C: Protocols
Posted
by Stu
on Stack Overflow
See other posts from Stack Overflow
or by Stu
Published on 2009-06-23T21:17:02Z
Indexed on
2010/06/14
9:32 UTC
Read the original article
Hit count: 318
objective-c
|protocols
I'd like an instance variable object to adopt a protocol.
@interface GameScene : Scene <AVAudioPlayerDelegate> {
@private
Layer *content <CocosNodeOpacity>;
}
For example I'd like my Layer object to adopt the <CocosNodeOpacity>
so that I can get the methods
-(GLubyte) opacity; //and
-(void) setOpacity: (GLubyte) opacity;
for free. The syntax shown above is invalid. Is it possible to achieve this without creating a new implementation file and creating a custom object? Thanks.
© Stack Overflow or respective owner