title: Can I pass the type of a generic variable as a parameter?
body: <p>I can declare the type of a class by declaring:</p>
  
  <pre><code>type
    TMyObject = class(TSomething);
    TMyObjectClass = class of TMyObject;
  </code></pre>
  
  <p>I'm trying to do something like this:</p>
  
  <pre><code>IData&lt;TIn,TOut&gt; = interface;
    IData = interface
      function GetGenericData&lt;Tin,TOut&gt;: IData&lt;TInput,TOut&gt;;
      function GetInType: TRttiType;
      function GetOutType: TRttiType;
    end;
  </code></pre>
  
  <p>Declare a base type that can give access to the generic type and give me info on what the generic Input and Output types are.</p>
  
  <pre><code>  IData&lt;TIn,TOut&gt; = interface(IData)
      ['{5B402458-22EC-4A8B-83F3-C11AC575B79E}']
      function GetInput(Index: Integer): TIn;
      function GetInputCount: Integer;
      function GetOutput(Index: Integer): TOut;
      function GetOutputCount: Integer;
      property Input[index: integer]: TIn read GetInput;
      property Output[index: integer]: TOut read GetOutput;
      property InputCount: integer read GetInputCount;
      property OutputCount: integer read GetOutputCount;
    end;
  </code></pre>
  
  <p>Here is the actual generic type that holds an 2 arrays of data. Note that the input and output does not need to be the same type.   </p>
  
  <p>I then have a class that contains one or more different types of <code>IData</code>.  </p>
  
  <pre><code>TStage = class(TPipelineStage, IData);
  TStage&lt;TIn, TOut&gt; = class(TStage, IData&lt;TIn, TOut&gt;);
  
  TMyPipeline = class
    fStages = TArray&lt;TStage&gt;;  &lt;&lt;-- this is really a list of TStage&lt;?,?&gt;
  </code></pre>
  
  <p>I want to have a list of different TStages in my class, but obviously I cannot code that.<br>
  How do I access the <code>TStage&lt;IInterfaceA, InterfaceB&gt;</code> and <code>TStage&lt;InterfaceB, InterfaceB&gt;</code> from <code>fStages</code>?  </p>
  
  <p>Can I use <code>class of ....</code> in this context and instantiate an object from there?</p>
  
  <p>The reason I'm using this approach is that I'm using a delegate in the Pipeline stage that is declared thus:</p>
  
  <pre><code>TDelegate&lt;TIn, TOut&gt; = reference to procedure(const Data: IData&lt;TIn, TOut&gt;);
  </code></pre>