I have a base generics class with an inner protected class. How do I inherit from the base class and access the protected inner class?
As an example this code will not compile:
unit uFoo;
interface
type
TFoo<T> = class
protected
type
TFooProtected = class
end;
end;
TFoo2<T> = class(TFoo<T>)
protected
item: TFooProtected;
end;
答案 0 :(得分:6)
Like this:
type
TFoo<T> = class
protected
type
TFooProtected = class
end;
end;
TFoo2<T> = class(TFoo<T>)
protected
item: TFoo<T>.TFooProtected;
end;
Note that this has nothing to do with generics. It is valid for any class where the type is declared internally.