implementation of design patterns using cpp