adding code for closure for accessing private varibles in object method.