V
Victor Hannak
I have two classes derived from a base class. The two derived classes each
utilize a structure that is slightly different from one another. i.e.
DerivedClass1:
struct NodeStruct {
float NodeValue;
ListStruct *NextNode;
}
DerivedClass2:
struct NodeStruct {
int NodeValue1;
int NodeValue2;
ListStruct *NextNode;
}
I would like to put a function in the base class to delete linked lists
created with these structs. The problem is that these structures are not
declared in the base class, nor can they be because each derived class
requires a slightly different structure. So the question is, how can I
reference a structure that will be declared in the derived class?
I am thinking that this is similar to a virtual function where it is
dynamically determined which derived class function to call. In my case, I
would like to define a generic structure pointer such that when the base
class function is called, the right structure is used according to which
derived class I am operating on.
Thanks, Vic
utilize a structure that is slightly different from one another. i.e.
DerivedClass1:
struct NodeStruct {
float NodeValue;
ListStruct *NextNode;
}
DerivedClass2:
struct NodeStruct {
int NodeValue1;
int NodeValue2;
ListStruct *NextNode;
}
I would like to put a function in the base class to delete linked lists
created with these structs. The problem is that these structures are not
declared in the base class, nor can they be because each derived class
requires a slightly different structure. So the question is, how can I
reference a structure that will be declared in the derived class?
I am thinking that this is similar to a virtual function where it is
dynamically determined which derived class function to call. In my case, I
would like to define a generic structure pointer such that when the base
class function is called, the right structure is used according to which
derived class I am operating on.
Thanks, Vic