Data structure and OOP in C++