Hi, This is a Gamma Et all pattern defined in the Design patterns book. Lets say we have a method defined like this.

An Object invoking the getMan method does not know which particular instance is created and is returned a Man. When he invokes walk on the Man Object returned he is returned 5 if the instance created is Rahul or 10 if the instance created is Sham. The method getman(..) is the Factory.