title: How to set up and derive a type from an abstract tagged record?
body: <p>I'm having some difficulties getting my head around inheritance in Ada, and with some syntax. </p>
  
  <p>My goal is to derive from an abstract type with a record, and use a different data type in the record field. Here's what I've been able to compile:</p>
  
  <pre><code>type Base is abstract new Parent.ParentType with record
      X:Access_Type;
  end record
  
  type Child is new Base with record
      n:Integer;
  end record;
  </code></pre>
  
  <p>But I don't want to have this additional n field, I'd like to have X  be an integer in the child type. I can't get the compiler to be happy with it. Something like the following is what I want:</p>
  
  <pre><code>type Base is abstract new Parent.ParentType with tagged record
      X:Access_Type;
  end record;
  
  type Child is new Base with record
      X:Integer;
  end record;
  </code></pre>
  
  <p>Unfortunately, I can't figure out how to tag the base type which I think would allow me to reassign the X field. (Without tagging, the compiler complains of conflicting declarations.)</p>
  
  <p>Can someone shed some light on this? I'm quite new to OO programming in general and I'm finding Ada's type approach more confusing than the usual class approach.</p>