Appelez la méthode de la sous-classe à partir de sa superclasse

J'ai deux classes, nommé Parent et Childcomme ci-dessous. Parent est la super-classe de Child je peux appeler une méthode de la super-classe à partir de son sous-classe en utilisant le mot-clé super. Est-il possible d'appeler une méthode de la sous-classe de sa super-classe?

Enfant.h

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

@interface Child : Parent {

}

- (void) methodOfChild;

@end

Enfant.m

#import "Child.h"

@implementation Child

- (void) methodOfChild {

    NSLog(@"I'm child");

}

@end

Parent.h:

#import <Foundation/Foundation.h>

@interface Parent : NSObject {

}

- (void) methodOfParent;

@end

Parent.m:

#import "Parent.h"

@implementation Parent

- (void) methodOfParent {

    //How to call Child's methodOfChild here?

}

@end

Importation Parent".h" en application du délégué .m-tête de fichier.

Application du délégué application:didFinishLaunchingWithOptions: méthode..

Parent *parent = [ [Parent alloc] init];

[parent methodOfParent];

[parent release];

source d'informationauteur Confused