Talk:Template method pattern
Appearance
I removed the following example and replaced it with mine, which I translated from the french version. Feel free to revert if you have reasons to do so. If not, feel free to correct my english :)
<removed stuff>
For example, given a skeleton for common operations on data structures, there may be a few common operations and some specific to the data structure. The data structure template class can provide a template for each newly added data structure class.
class CDatastructure_Template
{
//Common operations: Algorithm Template
void virtual CleanAll()=0;
void virtual AddNode(Node *node)=0;
void virtual DeleteNode(Node *node)=0;
long virtual GetNumElements()=0;
Node* virtual GetTopNode()=0;
Node* virtual GetNextNode(Node *CurrentNode)=0;
};
class CLinkList_ConcTemplate:public Datastructure_Template;
class CQueue_ConcTemplate:public Datastructure_Template;
class CArray_ConcTemplate:public Datastructure_Template;
class CTree_ConcTemplate:public Datastructure_Template;
New data structure class can be derived from the CLinkList_ConcTemplate, with operations modified as necessary.
</removed stuff>