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?
The general recommendation is to not derive from standard library containers. See also this questions answers.
The first answer to this question gives a note on the Liskov substitution principle which could be your answer.