Hi Martin,

you can try with virtual inheritance (not in the sense of dynamic 
polymorphism). I just found this: 
https://isocpp.org/wiki/faq/multiple-inheritance#virtual-inheritance-where 
<https://isocpp.org/wiki/faq/multiple-inheritance#virtual-inheritance-where>

This may help, I hope it does!

Best,
Dennis



> On 22. Dec 2022, at 13:40, Martin Utz <[email protected]> wrote:
> 
> Dear dumux community,
>  
> is it possible for a problem to inherit from two other problems?
>  
> In general, this seems to work, since Cpp supports several base classes. But 
> I am running into trouble since both parent problems inherit from the 
> FVProblem. Therefore the functions of the FVproblem (e.g. girdGeometry() ) 
> are ambiguous. I tried to solve this issue with using 
> ParentType1::gridGeometry. Since both base classes use FVProblem,  it should 
> not matter if I use ParentType1 or ParentType2.
>  
> But then I run into the next error, which I could not solve:
>  
> dumux/dumux/common/fvproblem.hh:596:15: error: 
> 'Dumux::FVProblem<Dumux::Properties::TTag::MyTTag>' is an ambiguous base of 
> 'Dumux::MyProblem<Dumux::Properties::TTag::MyTTag>' 
> 596 | { return *static_cast<const Implementation *>(this); }
>  
> This seams to me to be a quite basic error, therefore I was wondering if it 
> is in general possible for a problem to inherit from two other problems.
>  
> Is there a way to fix the inheritance? Or is this use of inheritance not 
> meant to be in dumux?
>  
> Best,
> Martin
>  
> Im Auftrag
> 
> Martin Utz
> 
> -- 
> Referat Numerische Verfahren im Wasserbau
> Abteilung Wasserbau im Binnenbereich
> 
> Bundesanstalt für Wasserbau
> Federal Waterways Engineering and Research Institute
> Kußmaulstraße 17 | 76187 Karlsruhe
> E-Mail: [email protected]
> 
> Tel.: +49 721 9726-3575
> Fax: +49 721 9726-4540
> https://www.baw.de 
> 
> 
> _______________________________________________
> DuMux mailing list
> [email protected]
> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to