DesignPattern/5.PrototypePattern/2.Code/main.cpp

52 lines
1.4 KiB
C++
Raw Normal View History

2019-10-20 03:06:41 +00:00
#include "PrototypePattern.h"
int main()
{
#if 0
ConcreteWork *singleWork = new ConcreteWork("Single",1001,"Single_Model");
printf("\nSingle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
singleWork->printWorkInfo();
printf("\njungleֱ<EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
ConcreteWork *jungleWork = singleWork;
printf("\nJungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
jungleWork->printWorkInfo();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B1BB>ʦ<EFBFBD><CAA6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("\njungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
jungleWork->setName("jungle");
jungleWork->setIdNum(1002);
WorkModel *jungleModel = new WorkModel();
jungleModel->setWorkModelName("Jungle_Model");
jungleWork->setModel(jungleModel);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ķ<EFBFBD><C4B6><EFBFBD>
printf("\nSingle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
singleWork->printWorkInfo();
printf("\nJungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
jungleWork->printWorkInfo();
#endif
ConcreteWork *singleWork = new ConcreteWork("Single", 1001, "Single_Model");
printf("\nSingle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
ConcreteWork *jungleWork = singleWork->clone();
printf("\nJungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B1BB>ʦ<EFBFBD><CAA6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("\njungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD>ѧ<EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
jungleWork->setName("jungle");
jungleWork->setIdNum(1002);
WorkModel *jungleModel = new WorkModel();
jungleModel->setWorkModelName("Jungle_Model");
jungleWork->setModel(jungleModel);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ķ<EFBFBD><C4B6><EFBFBD>
printf("\nSingle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
singleWork->printWorkInfo();
printf("\nJungle<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>\n");
jungleWork->printWorkInfo();
system("pause");
return 0;
}