Quote:Original post by T1Oracle
I don't understand why you didn't just do this:
*** Source Snippet Removed ***
Read my last sentence - you don't know my requirements.
What if Vector3D is internal format, which isn't available to the user and is merely provided for the renderer.
Also, your example no longer fires the event.
And reset position doesn't use Vector's default position, but position defined by particular map.
I also don't need to put inline in front of methods since I use "any suitable" for inlining, and "optimize for speed".
This also demonstrates nicely why it's somewhat pointless to ask others advice on design, without providing exact and detailed use-case.
The enum solution might work - I don't know. It's just uncommon. A map solution might work as well. Or overriding subscript operator. Or auto-generating accessors from IDL. Or providing dynamic type system. Or component oriented object composition.
There are no absolutely "good" or "bad", "right" or "wrong" ways. There is just suitable and unsuitable design. Yes, even singletons have their rightful place in design. They are just frequently unsuitable.