Logo

Programming-Idioms

History of Idiom 17 > diff from v8 to v9

Edit summary for version 9 by :

Version 8

2015-08-23, 22:47:34

Version 9

2015-08-23, 23:08:26

Idiom #17 Create a Tree data structure

The structure must be recursive. A node may have zero or more children. A node has access to children nodes, but not to his parent.

Idiom #17 Create a Tree data structure

The structure must be recursive. A node may have zero or more children. A node has access to children nodes, but not to his parent.

Code
type
generic
  TTree<_T> = class(TObject)
    Children: array of TObject;
    Data: _T;
  end;

type
  TStringTree = specialize TTree<String>;
Comments bubble
This Example uses generics