|
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Feb 2010
Posts: 2
|
Can some one help me with "@property"? I have two classes A and B , class A inherit NSObject and class B inherit class A, both classes A and B has property, now when i use setter it is fine but i got error at run time when i use getter.
----------------------------- Code:
You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor. @interface A:NSObject
{
int ageA;
}
@property int ageA;
@end
@implement A
synthesize ageA;
@end
@interface B:A
{
int ageB;
}
@property int ageB;
@end
@implement B
synthesize ageB;
@end
--------------------------
B *instance=[[B alloc] init];
//here are fine
[instance setAgeA:97];
[instance setAgeB:200];
//here get error say Bad access
NSLog(@"A age is: %d", instance.ageA);
NSLog(@"B age is: %d", instance.ageB);
|
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |




Linear Mode
