This is not possible (as @JaredPar already mentioned). Trying to put logic to work around this is a bad practice. In case you have a base class
that have an enum
, you should list of all possible enum-values
there, and the implementation of class should work with the values that it knows.
E.g. Supposed you have a base class BaseCatalog
, and it has an enum ProductFormats
(Digital
, Physical
). Then you can have a MusicCatalog
or BookCatalog
that could contains both Digital
and Physical
products, But if the class is ClothingCatalog
, it should only contains Physical
products.