我ManageMarketPacket.h有一个结构,就像如下:iphone,如何调用结构成员
#import <Foundation/Foundation.h>
typedef struct ORIGINAL_QUOTA_DATA_tag{
unsigned short id;
unsigned char exch;
}ORIGINAL_QUOTA_DATA;
@end
和ManageMarketPacket.m有一个功能打算拿到ID:
- (unsigned short)getId:(NetWorkConnect*)netWokrConnect{
//I want to get the id which have assigend in netWokrConnect.m
//I tried "return (netWokrConnect->oQuota).id; "is incorrect
}
在我NetWorkConnect.h,我所定义的结构:
#import <Foundation/Foundation.h>
#import "ManageMarketPacket.h"
@interface NetWorkConnect : NSObject{
ORIGINAL_QUOTA_DATA oQuota;
}
在NetWorkConnect.m,我分配oQuota.and在另一个文件中,我调用函数getId;
非常感谢你,但是有一点问题,“ - >”会得到警告“Instance variable'oQuota'is protected”,但点是正确的,再次感谢你.... – Gaojian922188