Ok, i have this program.......
It consists of a base class (component), and 2 derived classes (resistor and capacitor).
I also have another class (circuit), which has a private element of an array of pointers to a component object.
My main program creates a circuit object. Then accepts input and using a makepart function will make a
resistor or a capacitor....or nothing depending on the input. I have this working for as many components as i want to enter.
When i want to print the netlist, i hit p and it will print each part (resistor or capacitor) and then ends.
Previously it would not run any of the destructors (was getting abnormal program termination message), and ran the base and either cap or resistor constructors at the beginning.
I made the circuit class destructor virtual, and tried again and it shows that it ran the circuit destructor according to the output, which is what i need.
BUT i also need the base class (component) destructor to run but it doesnt.
I tried making it virtual but nothing...... that will only allow me to run the derived class destructors i believe anyways.
Any ideas???
The reason i need thes destructors to run are for deallocating memory. I can post the class declarations if needed but i won't yet.
It consists of a base class (component), and 2 derived classes (resistor and capacitor).
I also have another class (circuit), which has a private element of an array of pointers to a component object.
My main program creates a circuit object. Then accepts input and using a makepart function will make a
resistor or a capacitor....or nothing depending on the input. I have this working for as many components as i want to enter.
When i want to print the netlist, i hit p and it will print each part (resistor or capacitor) and then ends.
Previously it would not run any of the destructors (was getting abnormal program termination message), and ran the base and either cap or resistor constructors at the beginning.
I made the circuit class destructor virtual, and tried again and it shows that it ran the circuit destructor according to the output, which is what i need.
BUT i also need the base class (component) destructor to run but it doesnt.
I tried making it virtual but nothing...... that will only allow me to run the derived class destructors i believe anyways.
Any ideas???
The reason i need thes destructors to run are for deallocating memory. I can post the class declarations if needed but i won't yet.