I am porting cpp codes to obje开发者_运维百科ctive C. Is there any way to do the initialisation list declaration in objective C.
RsMsgRequestSession::RsMsgRequestSession()
: RsMsg(ID,NewMsg,NULL,&st,sizeof(st))
{
}
How to declare the same equivalent in objective C.
I am new to objective C.I am porting cpp codes to objective C.
...why? (as long as you know that it's not usually a worthwhile investment)
Is there any way to do the initialisation list declaration in objective C.
the equivalent of:
RsMsgRequestSession::RsMsgRequestSession() : RsMsg(ID,NewMsg,NULL,&st,sizeof(st)) {}
is:
@interface RsMsgRequestSession : RsMsg
@end
@implementation RsMsgRequestSession
- (id)init {
// assuming one of RsMsg's designated initializers take the form:
self = [super initWithID:ID message:NewMsg ambiguousArgumentName:NULL roleOfSt:&st sizeOfSt:sizeof(st)];
if (nil != self) {
/* init self here */
}
return self;
}
@end
精彩评论