|April 6, 2011, 05:17||
function objects and virtual inheritance
Join Date: Mar 2010
Posts: 16Rep Power: 7
I'm having a little programming problem here, so hopefully one of you C++ experts can help me out of it!
I have programmed multiple function objects, using three 3 levels of inheritance.
1st) BaseLevel 2nd) MethodsLevel 3) CustomizedMethods- and OutputLevel
In order to overcome the diamond problem, I introduced virtual inheritances (e.g. class B :: virtual public A).
This however causes the following compilation error message:
/graz/home/openfoam/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude/IOOutputFilter.C: In constructor ‘Foam::IOOutputFilter<OutputFilter>::IOOutputFilte r(const Foam::word&, const Foam:bjectRegistry&, const Foam::fileName&, Foam::IOobject::readOption, bool) [with OutputFilter = Foam::TurboPressure]’:
/graz/home/openfoam/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude/OutputFilterFunctionObject.C:78: instantiated from ‘bool Foam::OutputFilterFunctionObject<OutputFilter>::st art() [with OutputFilter = Foam::TurboPressure]’
HierarchyLevel2/TurboPressure/TurboPressureFunctionObject.C:41: instantiated from here
/graz/home/openfoam/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude/IOOutputFilter.C:53: error: no matching function for call to ‘Foam::TurboBase::TurboBase()’
lnInclude/TurboBase.H:157: note: candidates are: Foam::TurboBase::TurboBase(const Foam::word&, const Foam:bjectRegistry&, const Foam::dictionary&, bool)
lnInclude/TurboBase.H:113: note: Foam::TurboBase::TurboBase(const Foam::TurboBase&)
make: *** [Make/linux64GccDPOpt/TurboPressureFunctionObject.o] Error 1
Apparently I'm calling the constructor Foam::TurboBase::TurboBase() on line 53 of file IOOutputFilter.C.
I don't know why the line's actual constructor Foam::TurboBase::TurboBase(const Foam::word&, const Foam:bjectRegistry&, const Foam::dictionary&, bool) is not called, but it certainly has to do with the virtual inheritance declaration.
Any hints ????