0
Answer

REfering class within itself

Sairam Soham

Sairam Soham

9y
562
1

My main objective is to generate hierachial xml

In the dataset I have all the elements of hierarchy in one row


For example H1, H2, H3, H4 ,H5............

H1 is parent of H2

  H2 is child of H1 and parent of H3

    H3 is child of H2 and parent of H4

 H4 is child of H3 and parent of H5

    H5


I am planning to define a generic class which will have  properties of all hierarchies (H1, H2...H5...).  If one property exists in more than one hierarchy, then it will exist only in a class

   
For example

Id
Type
RatingKVA
Lat
Long


In the type I will  store H1, H2, H3.....


In order to define hierachial relationship (for example, H1's child is H2..........)

I am planning to call this generic class as list within itself.

Is this good approch? Do you see any problem with it?