I'm constantly getting a warning from the compiler when initializing a subclass:
Incompatible Objective-C types initializing 'struct Module *', expected 'struct Relais *'
It happens when the following line is called:
There's probably a very simple solution, but this is my second day of learning ObjC. And coming from the wonderful world of Java, I'm having a hard time figuring this one out
Module.h:
Module.m:
Relais.h:
Relais.m
Strangely enough the initWithIdentifier method IS called from the subclass 'Relais', and all methods from 'Relais' are indeed accessible

Incompatible Objective-C types initializing 'struct Module *', expected 'struct Relais *'
It happens when the following line is called:
Code:
Relais *object = [[Relais alloc] initWithIdentifier:identifier description:description];
There's probably a very simple solution, but this is my second day of learning ObjC. And coming from the wonderful world of Java, I'm having a hard time figuring this one out
Module.h:
Code:
#import <Foundation/Foundation.h>
@interface Module : NSObject {
NSString *identifier;
NSString *description;
}
-(Module *) initWithIdentifier: (NSString *) pIdentifier description: (NSString *) pDescription;
-(void) setIdentifier: (NSString *) pIdentifier;
-(void) setDescription: (NSString *) pDescription;
-(NSString *) identifier;
-(NSString *) description;
@end
Module.m:
Code:
#import "Module.h"
@implementation Module
-(Module *) initWithIdentifier: (NSString *) pIdentifier description: (NSString *) pDescription
{
self = [super init];
if (self) {
[self setIdentifier:pIdentifier];
[self setDescription:pDescription];
}
return self;
}
-(void) setIdentifier: (NSString *) pIdentifier
{
identifier = pIdentifier;
}
-(void) setDescription: (NSString *) pDescription
{
description = pDescription;
}
-(NSString *) identifier{
return identifier;
}
-(NSString *) description{
return description;
}
@end
Code:
#import <Foundation/Foundation.h>
#import "Module.h"
@interface Relais : Module {
BOOL aan;
}
-(Relais *) initWithIdentifier: (NSString *) pIdentifier description: (NSString *) pDescription;
- (void) setAan: (BOOL) pAan;
- (BOOL) aan;
-(NSString *) aanCommando;
-(NSString *) uitCommando;
@end
Code:
#import "Relais.h"
@implementation Relais
-(Relais *) initWithIdentifier: (NSString *) pIdentifier description: (NSString *) pDescription
{
self = [super init];
if (self) {
[self setIdentifier:pIdentifier];
[self setDescription:pDescription];
}
return self;
}
- (void) setAan: (BOOL) pAan
{
aan = pAan;
}
- (BOOL) aan
{
return aan;
}
-(NSString *) aanCommando {
return [identifier stringByAppendingString:@"%I"];
}
-(NSString *) uitCommando {
return [identifier stringByAppendingString:@"%O"];
}
@end
Strangely enough the initWithIdentifier method IS called from the subclass 'Relais', and all methods from 'Relais' are indeed accessible