I have 3 different classes inherited from 1 base class.
Objects are instantiated dynamically.

My base class is called Sensor and my 3 inherited classes are called typeA, typeB and typeC

The user can pick which object they want to instntiate
Code:
   if (type == 1) {
      head();
      sensor_a[Sensor::GetSensorCount() + 1] = new typeA;
   } else if (type == 2) {
      head();
      sensor_b[Sensor::GetSensorCount() + 1] = new typeB;
   } else {
      head();
      sensor_c[Sensor::GetSensorCount() + 1] = new typeC;
   }
a running total of objects derrived from the 3 classes is kept in the base class and the objects are given an identity number from this.

If I want to remove an object how can I do this as I only know the object identity number?

e.g.
Code:
   cout << "Enter sensor number to remove from the network: ";
   cin >> num;
   delete sensor[num];
   sensor[num] = NULL;
obviously this won't work as my objects are not called sensor.


I have a function in my base class
Code:
type Sensor::GetSenType() {
   return sensor_type;
}
which refers to an enumarated type
Code:
enum type {type_a = 1, type_b, type_c};
and if I could get to this it would return what type (a, b or c) that particular object was and I could give the delete command the correct type.


Is there a way to do this?

Any comments appricieted.

Thanks