I use 3-layer inheritance design below:
class connect_info {
// these members
};
class vertex : public connect_info {
// ...
};
// user-defined struct
class algo_vertex: public vertex {
// ...
};
members of connect_info
class(I call it these members
in this question) is only used in vertex
class. But to keep the semantic of vertex
class clear, I must separate these members
to another base class(connect_info
).
Problems generate here:
- how can I hide these members from user-defined class? (
protected
andprivate
are both useless now. If there is noconnect_info
base class,private
can work well) - Does multi-layer inheritance design make sense in any situation?
- Can virtual de-constructor function work well in multi-layer inheritance case?