I have two (unrelated) classes. The first one is "Point":
typedef std::complex<double> complex_number;
class Point
{
public:
Point(const complex_number &affix);
const complex_number & get_affix() const;
void set_affix(const complex_number & new_affix);
// etc
private:
complex_number affix_;
};
(By the way, sorry for asking this unrelated question, but where is the right place to put my type definitions? Is here, top of my point.hpp file, "good practice"?)
The second one is "Abstract_Vertex" (this is meant to be part of an abstract graph later):
typedef int vertex_label;
class Abstract_Vertex
{
public:
Abstract_Vertex(const vertex_label &label);
const vertex_label & get_label() const;
const vertex_label & get_neighbor_label(const int &index) const;
void set_label(const vertex_label &new_label);
bool is_neighbor_label(const vertex_label &label) const;
// etc
protected:
vertex_label label_;
std::vector<vertex_label> neighbor_labels_;
};
Now I want to create a third class, "Plane_Vertex" (a vertex located somewhere in the plane). I am pondering two ways to do that :
Multiple inheritance : the Plane_Vertex class inherits from both Point and Vertex, and does not have any members
the Plane_Vertex class only inherits from Vertex and has a private
Point point_
member.
Of course I could easily avoid multiple inheritance and just go for option 2., but I am a good little conscientious C++ learner and I want to know what "good practice" would be in my situation.
Thank you for your insights!