Is there a way to inherit nested types?
14:24 21 Dec 2025

We're using an attribute, which looks somewhat like this (simplified):

    unit SomeProject.ThreadLibrary.Attributes;

    interface

    type
      ThreadAffinityAttribute = class (TCustomAttribute)
      type
        TThreadAffinityFlag = (taAffinity1, taAffinity2);                   
        TThreadAffinityFlags = set of TAttributeFlag;
    
        constructor Create (SomeFlags: TThreadAffinityFlags); 
      private
        FFlags: TThreadAffinityFlags;
      public
        property Flags: TThreadAffinityFlags 
          read FFlags;
      end;

    implementation

      ...

In another unit there is an abstract class that is used as a base (ancestor) for several other classes which will use the attributes.

    type
      TCustomThreadHandler = class
      type
        TFlags = SomeProject.ThreadLibrary.Attributes.
                   ThreadAffinityAttribute.TThreadAffinityFlags;
      end;    

My intention was that any methods of classes deriving from TCustomThreadHandler should be able to use the type TFlags in their implementations as a "shorthand" type for the set type declared in the attribute class (to avoid having to type in the qualified name every time), but without introducing a TFlags into the global namespace that might collide with other data types. Unfortunately, though, the type is not inherited: The TFlags identifer is not known in derived classes.

Is there a way to do this other than making a global alias type (or having each derived class re-stating the nested type definition)?

delphi inheritance nested