#import <Foundation/Foundation.h> @interface TestClass : NSObject { @public NSString *myValue; @private NSString *myValue2; } @end @implementation TestClass @end int main(void) { TestClass *obj = [[TestClass alloc] init]; [obj setValue:@"hogehoge" forKey:@"myValue"]; [obj setValue:@"hogehogehoge" forKey:@"myValue2"]; NSLog(@"%@", [obj valueForKey:@"myValue"]); //2012-11-25 18:49:00.636 a.out[61231:707] hogehoge NSLog(@"%@", obj->myValue); //2012-11-25 18:49:00.642 a.out[61231:707] hogehoge NSLog(@"%@", [obj valueForKey:@"myValue2"]); //2012-11-25 18:49:00.643 a.out[61231:707] hogehogehoge NSLog(@"%@", obj->myValue2); // ここでWarning //2012-11-25 18:49:00.644 a.out[61231:707] hogehogehoge // ↑それでも表示出来る!! [obj release]; return 0; }