#import "SubSystemThree.h"
@implementation SubSystemThree
-(void)MethodThree{
NSLog(@"子系统方法三");
}
@end
SubSystemFour类接口
复制代码
#import <Foundation/Foundation.h>
@interface SubSystemFour:NSObject
-(void)MethodFour;
@end
SubSystemFour类实现
复制代码
#import "SubSystemFour.h"
@implementation SubSystemFour
-(void)MethodFour{
NSLog(@"子系统方法四");
}
@end
Facade类接口
复制代码
#import<Foundation/Foundation.h>
@class SubSystemOne;//此处@class关键字的作用是声明(不是定义哦)所引用的类
@class SubSystemTwo;
@class SubSystemThree;
@class SubSystemFour;
@interface Facade :NSObject{
@private SubSystemOne *one;
@private SubSystemTwo *two;
@private SubSystemThree *three;
@private SubSystemFour *four;
}
-(Facade*)MyInit;
-(void)MethodA;
-(void)MethodB;
@end
Facade类实现
复制代码
#import "Facade.h"
#import "SubSystemOne.h"
#import "SubSystemTwo.h"
#import "SubSystemThree.h"
#import "SubSystemFour.h"
@implementation Facade
-(Facade*)MyInit{
one= [[SubSystemOne alloc]init];
two= [[SubSystemTwo alloc]init];
three= [[SubSystemThree alloc]init];
four= [[SubSystemFour alloc]init];
return self;
}
-(void)MethodA{
NSLog(@"n方法组A() ---- ");
[one MethodOne];
[two MethodTwo];
[three MethodThree];
[four MethodFour];
}
-(void)MethodB{
NSLog(@"n方法组B() ---- ");
[two MethodTwo];
[three MethodThree];
}
@end
Main()方法调用
复制代码










