Multiple inheritance, function pointers or?
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.
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.
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,
|All times are GMT -4. The time now is 03:16.|