我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