Objective-C Fehler "Kein sichtbares @Interface für 'XYZPerson' deklariert den Selektor 'saySomething'

Ich bin wirklich neu in Objective-C und als ich die Buchübungen praktizierte, stecke ich wirklich hier fest. Bitte helfen Sie mir, das Problem zu lösen, und ich habe mehr als drei Stunden lang darüber nachgedacht, was diesen Fehler verursachen könnte. Trotzdem habe ich es nicht verstanden!

Viele Grüße, Raj.

Danke im Voraus !

main.m

#import <Foundation/Foundation.h>
#import "XYZPerson.h"
#import "XYZShout.h"
int main(int argc, const char * argv[])
{

    @autoreleasepool {

        //XYZPerson *some = [[XYZPerson alloc]init];

        XYZShout *some = [[XYZShout alloc]init];
        [some sayHello];



        // insert code here...
       // NSLog(@"Hello, World!");

    }
    return 0;
}

XYZPerson.h

#import <Foundation/Foundation.h>
@interface XYZPerson : NSObject

@property NSString *firstName;
@property NSString *secondName;
@property NSDate *dob;

-(void) saySomething;
-(void) sayHello;

@end

XYZPerson.m

#import "XYZPerson.h"
@implementation XYZPerson

-(void) sayHello {
    [self saySomething:@"Hello all"];
}

-(void) saySomething:(NSString *)greet {
    NSLog(@"%@", greet);
}

@end

XYZShout.h

#import "XYZPerson.h"

@interface XYZShout : XYZPerson

// -(void) saySomething;

@end

XYZShout.m

#import "XYZShout.h"

@implementation XYZShout

-(void) saySomething:(NSString *)greet {
    NSString *upperGreet = [greet uppercaseString];
    [super saySomething:upperGreet];    // this is where I get the error mentioned above
}

@end

Habe es geschafft! Danke an @MatthewD, @trojanfoe, @JFS für deine große Hilfe :)

Antworten auf die Frage(3)

Ihre Antwort auf die Frage