@interface SourceView : UIView
- (void)show;
- (void)hide;
@end
#import "SourceView.h"
@implementation SourceView
- (void)show {
}
- (void)hide {
@interface ChildOneView : SourceView
@end
#import "ChildOneView.h"
@implementation ChildOneView
- (void)show {
NSLog(@"ChildOneView");
}
- (void)hide {
// todo
}
@end
@interface ChildTwoView : SourceView
@end
#import "ChildTwoView.h"
@implementation ChildTwoView
- (void)show {
NSLog(@"ChildTwoView");
}
- (void)hide {
// todo
}
@end
#import "ViewController.h"
#import "SourceView.h"
#import "ChildOneView.h"
#import "ChildTwoView.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
SourceView *tmpView = [[ChildTwoView alloc] init];//或[[ChildTwoViewalloc]init]
[tmpView show];
}