title: Using Object Orientated subclasses in a separate form
body: <p><strong>I have created a factory unit that contains multiple subclasses for different functions.</strong></p>
  <p>FACTORY UNIT</p>
  <pre><code>//parent 
  type
   TfactoryU = class(Tobject)
   public
   constructor create;
   end;
  
   //subclass 1
   TFormPosition = class (TfactoryU)
   private
   fFormName:tform;
   public
   constructor create (formName:tform);
   procedure centerForm(frm:tform);
   end;
  
  implementation
  
  { TfactoryU }
  
  constructor TFormPosition.Create(formName:tform);
   begin
     Inherited Create;
     fFormName:=formname;
   end;
  
  procedure TFormPosition.centerForm(frm:tform);
  begin
    frm.Left := (Screen.Width - frm.Width) div 2;
    
  frm.Top := (Screen.Height - frm.Height) div 2;
  
  end;
  
  constructor TfactoryU.create;
  
  begin
  
  end;
  </code></pre>
  <p>However, I do not know how to call the subclass procedure from a different unit.</p>
  <p>MAIN UNIT</p>
  <pre><code>procedure TfrmMERCH.FormActivate(Sender: TObject);
  
  var
  
  objfactoryU:TfactoryU;
  
  begin
  
  objfactoryU:=tformposition.create(frmmerch);
  
  objfactoryU.centerForm(frmmerch);        
  </code></pre>
  <p>The calling of the procedure centerForm is underlined in red.</p>