Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

NotThatItMatters

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-16-2014
12:48 PM

2 Views

Class design questions

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.

1 Reply

Highlighted
##

NotThatItMatters

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-17-2014
07:51 AM

2 Views

From the "moot point"

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.

For more complete information about compiler optimizations, see our Optimization Notice.