DesignPattern in C++