Nice solution Exterminator

From Exterminator's solution I would like to inference one thing.

If variables (except pointers) of same type but meant for different functionality is needed at each hierarchy level then then this template solution can be applied as a generic solution to the problem.