Problem with class inheritance
I have a problem making my own class inheritance, i'm new in Objective C, i have been programing for a few weeks in a iPhone game.
I get this error:
"error: cannot find interface declaration for 'WPToucher', superclass of 'WPVersusTouch'"
I made a search about this error and i found that could be a recursive import problem, or something related with imports statments... but i cant really see the problem on my code...
I will explain how i want to make the class inheritance:
Super class WPToucher witch inherits from UIView
and WPVersusTouch witch should inherits from WPToucher
and other WPSurvivalTouch (i didn't created this yet) witch will inherit from WPToucher also
then:
WPToucher : UIView
WPVersusTouch : WPToucher
ok?
Now my code:
WPToucher.h
#import <UIKit/UIKit.h>
#import "GameYard.h"
@class GameYard;
@interface WPToucher : UIView {
GameYard *yard;
}
@property(nonatomic,retain) GameYard *yard;
-(void) dispatchTouchEvent:(UIView *)theView toPosition:(CGPoint)position;
-(void) dispatchFirstTouchAtPoint:(CGPoint)touchPoint forEvent:(UIEvent *)event;
- (id) initWithYard: (GameYard *) yardView;
@end
WPToucher.m
#import "WPToucher.h"
@implementation WPToucher
@synthesize yard;
- (id) initWithYard: (GameYard *) yardView {
self = [super init];
if (self != nil) {
yard=yardView;
}
return self;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
}
-(void) dispatchFirstTouchAtPoint:(CGPoint)touchPoint forEvent:(UIEvent *)event{
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
}
-(void) dispatchTouchEvent:(UIView *)theView toPosition:(CGPoint)position {
}
@end
WPVersusTouch.h
#import <Foundation/Foundation.h>
#import "WPToucher.h"
@class WPToucher;
@interface WPVersusTouch : WPToucher {
}
@end
WPVersusTouch.m
#import "WPVersusTouch.h"
@implementation WPVersusTouch
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
......
}
-(void) dispatchFirstTouchAtPoint:(CGPoint)touchPoint forEvent:(UIEvent *)event{
.....
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
.....
}
-(void) dispatchTouchEvent:(UIView *)theView toPosition:(CGPoint)position {
.....
}
@end
Thanks in advance!
Message was edited by: sebasgre
Message was edited by: sebasgre
Mac OS X (10.5.7)