DEV Community

loading...

Discussion on: The Three Little Creational Patterns - A Design Patterns Intro

Collapse
stylecramper profile image
Matt Anderson

Hi, I have a question about the Prototype example. In this code:

smallStickHouse.copy().addMailbox('wood')

You're calling StickHousePrototype's copy method, which returns a StickHouse instance, then calling the StickHouse instance's addMailbox method - am I right? I'm not sure the complete example makes sense.

Collapse
maxwell_dev profile image
Max Antonucci Author

Yeah, looking back on this now I may have aiming a bit too complicated for this example. Part of my edit will likely simplify this.