I have a product with the following internal structure: 1) a Root_Solver module to have all the root solving routines necessary to solve problems; 2) a base class FuncBase used by the Root_Solver module so that it may access functions to solve; 3) children of the base class to encompass individual needs in the program.
I am running into an implementation problem that has to do with some of the child classes requiring specific solver routines for internal calculations. Obviously this may lead to circular referencing. So how might one handle this?
Specifically, child FuncOne requires a routine from the Root_Solver to solve for an internal variable. At the same time, child FuncOne has class functions used to solve for other variables using another Call. I get no build problems when I create the output, but when run the program complains vehemently after the internal solver routine is called that the FuncOne class variables are all undefined.
From the "moot point" department, there is a simple fix for this. All I need to do is create Root_Solver as a class with appropriate procedures and private variables. Each time a routine gets called, it would set up the appropriate variables. Each time the variable goes out of scope, the final procedure would be called.
In truth, the same was happening in the post above, but once the second call was made, the first class pointer was "finalized" thereby making all its variables undefined.