Right so I am trying to inherit 2 things from the super class but it wont work? I shall put comments in the code to show were it wont work.
This inheritance wont work as it wont inherit from the superclass
Here is the code
Code:
#import <Cocoa/Cocoa.h>
@interface Person : NSObject
{
NSString *name;
int age;
}
@property (nonatomic, assign) int age;
@property (nonatomic, retain) NSString *name;
-(void) Speech;
@end
@implementation Person
@synthesize age;
@synthesize name;
-(void) Speech
{
NSLog(@"I am a human!");
NSLog(@"I am %@! I am %d years old!", name, age);
}
@end
@interface Boy : Person
@end
@implementation Boy
-(void) Speech
{
}
@end
int main()
{
Boy *boy = [[Boy alloc] init];
boy.name = @"Jimbob";
boy.age = 1;
[boy Speech];
return 0;
}
Nothing comes out?
Please could someone point out the flaw?
Sorry for the continuous threads,
Arc