473,382 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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.

Oct 27 '05 #1
3 1535
ectoplasm wrote:
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
Oct 27 '05 #2

ectoplasm wrote:
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-lit....html#faq-31.2

Cheers! --M

Oct 27 '05 #3
"ectoplasm" <e_*****@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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).
Oct 30 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
8
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical)...
24
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office...
18
by: Frank Rizzo | last post by:
Hello, I have a class with all static methods that is called by multiple threads. I was wondering what effect that has on the competing threads. Does Thread2 have to wait until Thread1 is done...
6
by: David Lozzi | last post by:
Howdy, I'm new to classes. Below is my class User. (is this a reserved namespace or class?) It works great, kind of. If I specify the username and password, the correct firstname and lastname...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
86
by: jopperdepopper | last post by:
Hi, finally giving php 5 a go, and going over the new approach to classes. Can someone clarify the public, private and protected to me? I quote the php manual: "The visibility of a property or...
16
by: chameleon | last post by:
I have 2 classes with exactly the same members (all static except dtor/ctor). Classes have different implementantion in only one static member function and first class has one more member...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.