usr-local-bin
usr-local-bin

Reputation: 43

How do I properly wrtite this method out to get rid of the "missing @end" error?

#import <Foundation/Foundation.h>
#import "SuperHero.h"

                                                                      'missing @end'
@implementation Superhero : NSObject 


-(int)Fight:(int)enemyStamina{


    int resultingStamina = enemyStamina - 5;

    return resultingStamina;
}

@end

Upvotes: 2

Views: 53

Answers (2)

Lexandr
Lexandr

Reputation: 689

This is valid code (syntax). Without header code I can't say more, but probably You miss @end in header file. Also, try to clean and rebuild your project.
Also, as kambala mentioned, specify inheritance with @interface directive.

Upvotes: 1

kambala
kambala

Reputation: 2511

Inheritance is specified only in the @interface section. So remove the : NSObject part in your code and you'll be fine.

Upvotes: 0

Related Questions