I want to subclass a singleton class, in this case SpriteFrameCache. The way singletons are implemented in cocos2d-x right now, they can’t be easily subclassed, as far as I can tell. (So why are some data members even protected - why not private?).
One conceivable solution could be to have a new static member
SpriteFrameClassCreator *_subclassCreatorin the singleton class. In getInstance(), if the static member is set, call
Otherwise, just call constructor as usual. (The pointer would be set with a new static method).
Would a solution along these lines have a chance of being accepted into cocos2d-x? In that case, I think it should be done for all the singleton classes.