title: Is it possible to inherit members as pointers?
body: <p>I want to if it's possible to inherit members as pointers.</p>
  
  <pre><code>struct base 
  {
      int x, y;
  };
  struct derived : public base 
  {   
      // inherit x and y as int pointers
  }
  </code></pre>
  
  <p>It doesn't have to look like the example above, as long as the behavior is similar.</p>
  
  <p>I'm want to use this for SOA(Structure of Arrays) .</p>
  
  <p>pseudo code:</p>
  
  <pre><code>template&lt;size, return_type, ...traits&gt;
  struct Soa&lt;size, return_type, traits...&gt; {
      Soa&lt;size, return_type, traits...&gt;()
      {
          /*
              buld the rdata as something like this
              for(int i = 0; i &lt; size; i++) {
                  rdata[i] = {&amp;get&lt;I&gt;(soa_data)[i]...}; 
              }
          */
      }
  
      second_type : public return_type
      {
          // inherit members as pointers
      }
  
      return_type &amp;operator[](int i)
      {
          return (return_type &amp;)rdata[i];
      }
      tuple&lt;traits[size]...&gt; soa_data;
      second_type rdata[size];
  
  };
  // sample use of the Soa
  struct base {
      int x, y;
  };
  Soa&lt;100, base, int, int&gt; soa; // where the two ints correspond to the members of base
  base &amp;b = soa[i];
  </code></pre>
  
  <p>Or maybe I'm thinking of the problem the wrong way?</p>