added example for factory method pattern