so I am developing a library for dealing with trees (as graph structures). I already have a class Tree
that implements many things.
I now want to create two new classes, let's say Tree2D
and Tree3D
, that will inherit from Tree
, and for which I will add 2D and 3D geometry.
As I plan to have several methods that can be applied to both 2D and 3D geometry, I would like to create a class TreeGeometry
, in which I will implement those methods, and then make Tree2D
and Tree3D
inherit from it.
However, I do not want that someone can instance TreeGeometry
objects directly. In a sense, I want this class to be "private". I've read about abstract class, so I think it might be the appropriate thing, but I'm not sure that I can make such an abstract class inherit from Tree
.
Any advice on how I should proceed ?