添加prototype设计模式

master
a7458969 2020-05-18 21:34:05 +08:00
parent 929c964164
commit 858356d508
2 changed files with 27 additions and 18 deletions

View File

@ -20,8 +20,7 @@
</component>
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
<generated>
<config projectName="generallib" targetName="General" />
<config projectName="generallib" targetName="generallib" />
<config projectName="General" targetName="General" />
</generated>
</component>
<component name="CMakeSettings" AUTO_RELOAD="true">
@ -86,21 +85,24 @@
<recent name="D:\project\c++\generallib\src\encrypt" />
</key>
</component>
<component name="RunManager" selected="CMake Application.General">
<configuration name="General" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="generallib" TARGET_NAME="General" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="generallib" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="generallib" TARGET_NAME="generallib" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<item itemvalue="CMake Application.generallib" />
<item itemvalue="CMake Application.General" />
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="General" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="General" TARGET_NAME="General" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
<component name="SvnConfiguration">
<configuration />
@ -174,12 +176,13 @@
<map>
<entry key="MAIN">
<value>
<State />
<State>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="361" y="110" key="#New_File_Extensions" timestamp="1589793685936">

View File

@ -13,18 +13,24 @@ public:
return nullptr;
}
};
template<typename T>
class CloneAble{
public:
virtual T* Clone(){
}
}
template<typename T>
class Prototype{
public:
Prototype(T ){
Prototype(CloneAble<T> *){
}
virtual T*GetProduct(){
return mProto->Clone();
}
private:
T *mProto;
CloneAble<T> *mProto;
Prototype(){}
};
#endif //GENERAL_FACTORY_HPP