Its a fine idea. For reference, here is the letter/envelope idiom, due to Coplien. [ You can use an
enum
instead; obviously need to handle errors etc. The parallel being that the base type is public and the implementation hidden. See below.I'd just make the initial
ShapeImpl
declaration public; what problems does that cause?
See: example with a Shape