Template method pattern: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 5:
'''Example:'''
Define the skeleton for Data-structure algorithms. Each kind of Data-structure algorithm has few common operations and few specific. The Data-structure template class can provide skeleton for each newly added Data-Structure Class.
 
----
 
class CDatastructure_Template
Line 17 ⟶ 19:
};
 
class CLinkList_ConcTemplate : public Datastructure_Template;
class CQueue_ConcTemplate : public Datastructure_Template;
class CArray_ConcTemplate : public Datastructure_Template;
class CTree_ConcTemplate : public Datastructure_Template;
 
----
 
 
If we need to introduce a new data-structure class double-link list then we can drive it from CLinkList_ConcTemplate to get the algorithm template and can modify operations.