Possible Duplicate:
Prefer composition over inheritance?
A general question which I stumbled upon several times recently: What are the advantages and disadvantages of deriving as opposed to containing?
To be more specific:
class A : public std::vector<int> {};
or
class B {public: std::vector<int> elem;}
?
Of course in a production code I would declare elem
as private and implement public getters and setters.
Is there a general recommendation?