Implementation of Design patterns in C++