Example #1
0
int main()
{
	//ConcreteClassA与ConcreteClassB可相互替换
	AbstractClass* pAbstract = new ConcreteClassA();
	pAbstract->TemplateMethod();

	pAbstract = new ConcreteClassB();
	pAbstract->TemplateMethod();

	return 0;
}
Example #2
0
int main() 
{ 
	AbstractClass* pConcreateClass = new ConcreteClass();
	pConcreateClass->TemplateMethod();

	delete pConcreateClass; 
	
	system("pause"); 
	return 0; 
}