I am trying to implement the state design pattern using C++/CLI. This pattern requires that the State class be a friend of the Context. But C++/CLI does not allow a friend class. I understand that this is also the case with C#. Has anyone implemented the state pattern with C++/CLI or C#? I would like to know how you got around the absence of friend class.
I am trying to implement the state design pattern using C++/CLI. This pattern requires
Share
Its done using Association (or what all the cool kids are calling Dependency Injection). Inject the state into the context. See the implementation on DoFactory