A
AdamJoe1
In my application I have a Connection class which has, amongst others,
attributes which represent a host id and port number. These must be unique
for each Connection. I want these attributes to be initialised to values
given by the constructor's parameters. I know in advance how many Connection
classes I need and what the values of these attributes will be. The
Connection class instances are created at various points during the
intialisation phase of the application. I want to hold, in one place, all
the possible values of host id and port number that the application can use.
This way, whenever the need for another Connection instance arises, a new
value can just be added to the list. I was thinking of a ConnectionDetails
class could do this but I'm not sure how best to implement it. It may be
that it will just contain constant data or enums. I don't want to have a
header file full of #defines that I include all over the place. Can anyone
help?
attributes which represent a host id and port number. These must be unique
for each Connection. I want these attributes to be initialised to values
given by the constructor's parameters. I know in advance how many Connection
classes I need and what the values of these attributes will be. The
Connection class instances are created at various points during the
intialisation phase of the application. I want to hold, in one place, all
the possible values of host id and port number that the application can use.
This way, whenever the need for another Connection instance arises, a new
value can just be added to the list. I was thinking of a ConnectionDetails
class could do this but I'm not sure how best to implement it. It may be
that it will just contain constant data or enums. I don't want to have a
header file full of #defines that I include all over the place. Can anyone
help?