title: Delphi record helper for double
body: <p><strong>SITUATION</strong></p>
  
  <p>I have written a class for second degree equations that looks like this. You can find <a href="http://pastebin.com/G0B07yQp" rel="nofollow noreferrer">here</a> the full code of the class but it's not very relevant for the question.</p>
  
  <pre><code>type
   TArrayOfDouble = array of array of double;
  
  type
   TEqSecGrado = class
    private
     //variables
     a, b, c: double;
     delta: double;
     solutions: TArrayOfDouble;
     solRealCount: integer;
     solImaginaryCount: integer;
     class var currentIstances: integer;
     class var totalIstances: integer;
     //methods
     function getDelta(const vala, valb, valc: double): double; overload;
    public
     constructor Create(const a, b, c: double);
     destructor Destroy; override;
     //methods
     function getDelta: double; overload;
     function getSolutions: TArrayOfDouble; virtual;
     //properties
     property valueOfA: double read a;
     property valueOfB: double read b;
     property valueOfC: double read c;
     property realSolutionsCount: integer read solRealCount;
     property imaginarySolutionsCount: integer read solImaginaryCount;
     class property currentEquationsCount: integer read currentIstances;
     class property totalEquationsCount: integer read totalIstances;
   end;
  </code></pre>
  
  <p>I thought to create a new type called <code>TArrayOfDouble</code> that will contain the solution of my equation. In the main form I use the class in this way:</p>
  
  <pre><code>procedure TForm3.Button1Click(Sender: TObject);
  var solver: TEqSecGrado;
      soluzioni: TArrayOfDouble;
  begin
  
   //f(x) = 3x^2 - x - 2 -&gt; [sol.1 = 1 | sol.2 = -0,666666666666667]
   solver := TEqSecGrado.Create(3,-1,-2);
  
   try
    soluzioni := solver.getSolutions; 
    //soluzioni[0][0] = 1; soluzioni[0][1] = 0; 
    //soluzioni[1][0] = -0,666666666666667; soluzioni[1][1] = 0; 
   finally
    solver.Free;
   end;
  
  end;
  </code></pre>
  
  <p>Now I have the results inside <code>soluzioni</code> and I can output them. (I have used a matrix because in the first spot I put real solutions, in this case 1 and -0.67, and in the second sport immaginary solutions if needed).</p>
  
  <hr>
  
  <p><strong>QUESTION</strong></p>
  
  <p>When I output the solutions I want to convert them into a fraction. I wanted to do something like <code>soluzioni[a][b].toFraction</code>. So I thought I could use a record helper for double.</p>
  
  <pre><code>type
   TSupport = record helper for Double
     function toFraction: string;
     function toString: string; //I have added this LATER
   end;
  </code></pre>
  
  <p>Here I come with my doubt. Once I have created the <code>TSupport</code> and the <code>toFraction</code> method, I was able to call soluzioni[0][0].toFraction but I couldn't call soluzioni[i][0].toString.</p>
  
  <p>To solve my problem I decided to add the function toString and everything worked. Does the record helper hide all the other methods? If I removed the record helper instead, I can use again the toString method as always.</p>
  
  <p>I know that helpers are a way to extend a class without using inheritance, but why can I use only the methods I've declared in my helper?</p>