|
[Sponsors] |
March 20, 2009, 11:36 |
Multiple inheritance, function pointers or?
|
#1 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
Hi all
I have moved into an area of the C++ programming, where I do not feel on solid ground anymore, thus I hope to get some advice/ideas from the more experienced of you. Background: I am making a new template class derived from mixedFvPatchField<Type>. From this template class I am going to derive certain wave-boundary conditions, such as Stokes First Order Theory, Stokes Second Order Theory, and whatever theory you would like. This is the straight forward part. Further I am working on a class, which I call geometricIntersections. This class take an expression for an interface (water surface in this case) and returns an object describing how much of the face is wet, the center of the wet part, etc. I am going to use this class elsewhere, thus I do not want to implement it directly into the template class. The description of the interface is naturally placed in the derived boundary classes. Question: I have been looking into different litterature/googled the possibilities and I have come up with two approaches. 1. Inherite the geometric class. This requires multiple inheritance, and there seems to be many pro and cons in this regard. The one I am especially worried about is the fact, that the this-pointer is only pointer at one of the base-classes. Is there a standard, which says at which base class it is pointing, e.g. the first one in the inheritance declaration? Here the description of the interface is given as a virtual function. 2. The other possibility is to use function pointers, but as I see it, it is kind of messy to make the interface in such a way. I am greatful for any suggestions or advice. Have a nice weekend, Niels |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compile problem | ivanyao | OpenFOAM Running, Solving & CFD | 1 | October 12, 2012 10:31 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 15:11 |
Error with Wmake | skabilan | OpenFOAM Installation | 3 | July 28, 2009 01:35 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |