1 Star 0 Fork 3

411592004/DesignPatternInC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.c 911 Bytes
一键复制 编辑 原始数据 按行查看 历史
GoodmanTao 提交于 2019-04-21 22:37 +08:00 . init
#include <stdio.h>
#include <apr_pools.h>
#include "IComponent.h"
#include "ComponentWindow.h"
#include "DecoratorScrollBar.h"
#include "DecoratorBlackBorder.h"
int main(int argc, char **argv)
{
apr_pool_t *pMemPool;
apr_initialize();
apr_pool_create(&pMemPool, NULL);
IComponent *pComponent = ComponentWindow2IComponent(ComponentWindow_New(pMemPool));//具体类型定义,抽象构件声明
IComponent *pDecorator = DecoratorScrollBar2IComponent(DecoratorScrollBar_New(pMemPool, pComponent));//定义透明装饰器并对构件进行装饰
IComponent *pDecorator2 = DecoratorBlackBorder2IComponent(DecoratorBlackBorder_New(pMemPool, pDecorator));//再次对构件进行装饰
pDecorator2->Display(pDecorator2);
pDecorator2->Free(&pDecorator2);
pDecorator->Free(&pDecorator);
pComponent->Free(&pComponent);
apr_pool_destroy(pMemPool);
apr_terminate();
return EXIT_SUCCESS;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/bailingniao_760/DesignPatternInC.git
git@gitee.com:bailingniao_760/DesignPatternInC.git
bailingniao_760
DesignPatternInC
DesignPatternInC
master

搜索帮助