January 2017
Intermediate to advanced
314 pages
6h 42m
English
While representing part-whole hierarchies (tree-structured), the composite design pattern describes a group of objects to be treated in a uniform manner, as if the leaf node and interior nodes are instances of the same object. A document object can contain multiple tables, and we can nest tables as well. This is an instance of a part-whole hierarchy, and composite design pattern is a natural choice here. To create a composite, we need to declare a base class, and all objects should be derived from this base class:
public abstract class TDocumentElement { public List<TDocumentElement> DocumentElements { get; set; } //------ The method given below is for implementing Visitor Pattern public abstract ...Read now
Unlock full access