|
[Sponsors] |
January 10, 2016, 10:08 |
Inherit debug value in derived class?
|
#1 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
Is there a way to do this? I have slight variations of a model that I would like to be able to turn on debugging for by "flipping" the switch of the base class.
|
|
January 10, 2016, 17:18 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Hi Pete,
An example would make it easier to give a counter example and to test it to be certain of it... Anyway, in theory, simply use the usual "access methods and variables from the parent class by calling it directly". For example, if you have something that is somehow derived from "fvPatchField", you should be able to simply do: Code:
fvPatchField::debug = 1; Bruno
__________________
|
|
January 10, 2016, 22:56 |
|
#3 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
Thanks for your insight Bruno!
This seems to suit my needs (inside constructor for derived class): Code:
if (not debug and baseClass::debug) { debug = baseClass::debug; } |
|
January 11, 2016, 08:19 |
|
#4 |
Senior Member
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13 |
There is an issue with using this method, however. You can turn on debugging using the switch for the base class, but you can't turn it off.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
The udf.h headers are unable to open- in VISUAL STUDIO 13 | sanjeetlimbu | Fluent UDF and Scheme Programming | 4 | May 2, 2016 05:38 |
How are the integration constants for the JANAFthermo class derived? | tomf | OpenFOAM Running, Solving & CFD | 2 | May 15, 2015 07:47 |
OF-2.2.x: Derived class from cellZone and "undefined symbol error" | A_Pete | OpenFOAM Programming & Development | 6 | April 28, 2014 01:53 |
How to access solver fields from fvPatchField%2360Type derived class that defines BC | kar | OpenFOAM Running, Solving & CFD | 0 | February 29, 2008 12:41 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 20:30 |