I have a scenario with 4 classes like,
class SuperGroup,
class Group,
class SubGroup,
class MicroGroup,
Here, SuperGroup will contain a list of Groups, and a Group will contain a list of SubGroups and so on...
Now, I want to design my classes in a way that,
Groups can only be created by SuperGroups, and similarly SuperGroups could only create Groups, they cannot create SubGroups directly. Rather when they want a SubGroup, they have to create a Group, then by that object of Group, they could create subGroups.
The same conditions will also apply to < Group,SubGroups > , < SubGroups,MicroGroups > .
How could I achieve that in C#.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…