I
Ira Gladnick
Would anyone have an idea how to code a base class such that multiple
subclass instances could exist simultaneously, but with the
restriction that there could be only one instance of any particular
subclass at any one time? (My specific need for this relates to form
creation, but seems like a general problem.)
That is, each subclass would be a singleton, but only in regards to
creation of other instances of the exact same subclass.
What I am looking for is a way to code this behaviour entirely in the
base class itself, without requiring the insertion of any
subclass-specific code in the subclasses themselves.
Is there perhaps a way to do this via a clever use of reflection?
subclass instances could exist simultaneously, but with the
restriction that there could be only one instance of any particular
subclass at any one time? (My specific need for this relates to form
creation, but seems like a general problem.)
That is, each subclass would be a singleton, but only in regards to
creation of other instances of the exact same subclass.
What I am looking for is a way to code this behaviour entirely in the
base class itself, without requiring the insertion of any
subclass-specific code in the subclasses themselves.
Is there perhaps a way to do this via a clever use of reflection?