 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ectoplasm Guest
|
Posted: Thu Oct 27, 2005 4:21 am Post subject: Classes & data members |
|
|
I'd like to ask for advice on the following.
I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)
The network elements are organised under a network topology
('NetworkTopology' class).
The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.
Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?
Bye,
E.
|
|
| Back to top |
|
 |
John Harrison Guest
|
Posted: Thu Oct 27, 2005 7:16 am Post subject: Re: Classes & data members |
|
|
ectoplasm wrote:
| Quote: | I'd like to ask for advice on the following.
I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)
The network elements are organised under a network topology
('NetworkTopology' class).
The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.
Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?
Bye,
E.
|
No there isn't.
To help us solve your problem you need specify more information. For
instance do you need to add and remove these data members during the
lifetime of a single object.
Server s;
s.add_group(xyz);
s.remove_group(abc);
etc.
Or are you saying that each object has one particular set of data
members that will last for the lifetime of that object, but that each
object may have a different set of data members?
john
|
|
| Back to top |
|
 |
mlimber Guest
|
Posted: Thu Oct 27, 2005 1:21 pm Post subject: Re: Classes & data members |
|
|
ectoplasm wrote:
| Quote: | I'd like to ask for advice on the following.
I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)
The network elements are organised under a network topology
('NetworkTopology' class).
The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.
Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?
Bye,
E.
|
You might be interested in "virtual data" that can be simulated in C++.
See the FAQ:
http://www.parashift.com/c++-faq-lite/value-vs-ref-semantics.html#faq-31.2
Cheers! --M
|
|
| Back to top |
|
 |
Jim Langston Guest
|
Posted: Sun Oct 30, 2005 4:16 am Post subject: Re: Classes & data members |
|
|
"ectoplasm" <e_c_t_o (AT) hotmail (DOT) com> wrote
| Quote: | I'd like to ask for advice on the following.
I have a data structure of network elements ('NetworkElement' base
class & derived classes like Server, Area, Cell, etc.)
The network elements are organised under a network topology
('NetworkTopology' class).
The problem is that the properties (data members) of network elements
depend on things such as: 1) technology of the network topology, 2)
vendor of the network element, 3) other factors.
Is there a way to, in some way, have classes with kind of 'dynamic'
data members which can be added / removed (in groups)?
Bye,
E.
|
Why not simply make the network elements polymorphic data contained in the
NetworkTopology perhaps in a vector?
std::vector<NetworkElement*> NetElements;
then you can push whatever types you want into it depending on the type of
network (perhaps in the constructor via pass in parm stating the network
type).
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|