title: How to dereference pointer to a class instance?
body: <p><strong>Problem abstract:</strong> I point a pointer to a class instance, but, when I try to dereference this pointer and access the properties of the instance, I get an EAccessViolation exception because it dereferences to "Nil".</p>
  
  <p>I declare the pointer in the unit scope:</p>
  
  <pre><code>private
    CurrentRXFrame: ^TSXcpFrame;
  </code></pre>
  
  <p>Every time my program receives a frame, the pointer is updated to point to this latest frame:</p>
  
  <pre><code>procedure TfrmFoo.OnReceivingFrame(Sender: TObject);
  var
    SXcpFrame: TSXcpFrame;
  begin
    SXcpFrame := TSXcpFrame.Create();
    CurrentRXFrame := @SXcpFrame;
  </code></pre>
  
  <p>I try to dereference the pointer in some other routine in the same unit, but get an exception:      </p>
  
  <pre><code>// `FrameBytes` is merely a dynamic array of type "Byte".
  PrintMsg(IntToHex(CurrentRXFrame^.FrameBytes[0], 2)); 
  </code></pre>
  
  <p>The exception:</p>
  
  <p><code>raise exception class EAccessViolation with message 'Access violation at address 004DD1FE [...] Read of address 00000010.</code></p>
  
  <p>If I set a breakpoint right before this line here is what the relevant vars evaluate to:</p>
  
  <pre><code>CurrentRXFrame := $18FD10
  CurrentRXFrame^ := nil
  CurrentRXFrame^.FrameBytes := Inaccessible value
  </code></pre>
  
  <p><strong>Question:</strong> How do I access the properties of an instance of class <code>TSxcpFrame</code> through a pointer?</p>