I am trying to create an object model for a chatserver. The chatserver is the root class. any class inside the root class should not be instantiable or accessible outside of a chatserver object ( an instance of the chatserver class ).
There are 2 collections ( objects that act like a collection ) inside the ChatServer root object, Channels ( ChannelsCollection class ) and Clients ( ClientsCollection class ).
The Channels collection contains Channel objects ( instances of the Channel class ).
The Channel class should only be accessible from within the Channels colletion.
The Clients collection contains Client objects ( instances of the Client class ).
The Client class should only be accessible from within the Clients colletion.
A Channel object has a collection Clients ( same ClientsCollection class as used in the ChatServer object )
Here is a diagram:
Can someone show me how thats done? ( Only Chatserver, Channels and Channel class is enough )