[vtk-developers] Multiple inheritance
Paul Douglas Hahn
pdhahn at compintensehpc.com
Mon Jul 2 17:07:18 EDT 2018
revise "base classes" -> "interface classes"
On 07/02/2018 04:04 PM, Paul Douglas Hahn wrote:
> Just one caveat (you probably already know and agree with this). In my
> experience using C++ multiple inheritance, I think you should try to
> avoid situations where you have common base classes in the inheritance
> pathways. Virtual base classes are the usual recommendation to resolve
> certain problems that arise in such cases, but IMHO having experience
> with that, I generally recommend against it.
>
> So I recommend your base classes should be of the "_mix-in_" interface
> category, not relaying on any common base class. The approach works
> fine for me in almost every situation.
>
> - Paul
>
> On 07/02/2018 12:44 AM, Todd Martin via vtk-developers wrote:
>> Single inheritance languages like Java and C# utilize /interfaces/
>> extensively. Python 2.7+ handles the same concept with abstract base
>> classes, ABCs.
>>
>> Is there any interest in supporting/interfaces/ in VTK via multiple
>> inheritance from abstract classes (which do not inherit from
>> vtkObject) while retaining the single inheritance model?
>>
>> In my view there are good reasons to do so. For example vtkCell has
>> methods like GetNumberOfEdges(), GetEdge(), GetNumberOfFaces(),
>> GetFace() etc. which really only apply to multi-dimensional cells
>> (both linear and non-linear); i.e. not points and lines. These
>> methods are forced on the base class design by a single inheritance
>> structure and the linear/non-linear cell sub-types. In my view it
>> would be better if they were distributed across the sub-classes via
>> the concept of interfaces. So I'm suggesting a limited use of
>> multiple inheritance here, not a free-for-all approach. What do
>> others think about this?
>>
>> For an example please see this merge request Add missing size hints
>> and bug fix point arrays for non-linear cells (!4372) · Merge
>> Requests · VTK / VTK
>> <https://gitlab.kitware.com/vtk/vtk/merge_requests/4372>
>>
>>
>>
>>
>>
>>
>>
>>
>> Add missing size hints and bug fix point arrays for non-linear
>> cells (!4...
>>
>> I've added size hints for concrete public methods
>> GetParametricCoords(), GetEdgePoints() and GetFacePoints() in ...
>>
>> <https://gitlab.kitware.com/vtk/vtk/merge_requests/4372>
>>
>>
>>
>> Todd Martin, PhD.
>> /Freelance Engineer/Software Architect./
>>
>>
>>
>> _______________________________________________
>> Powered bywww.kitware.com
>>
>> Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at:http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> https://public.kitware.com/mailman/listinfo/vtk-developers
>>
>
>
> --
> Paul D. Hahn
> CompIntense HPC, LLC
--
Paul D. Hahn
CompIntense HPC, LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtk-developers/attachments/20180702/711a29c3/attachment.html>
More information about the vtk-developers
mailing list