title: How to declare a reference to a member in the same class?
body: <p>I looked at a lot of other questions and answers and no one seems to have the same question I do.</p>
  
  <p>I am trying to make references to variables, both within a class. I took out the part of the larger program I am writing and isolated it in a little file: test.cpp. I thought maybe my problem had something to do with how I was using the variable with the reference, but the same messages appeared as in the larger program.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Test {
  public:
      int test;
      int&amp; rtest = test;
  };
  
  int main() {
      std::cout &lt;&lt; "Enter an integer: ";
      std::cin &gt;&gt; Test.rtest;
      std::cout &lt;&lt; "\n" &lt;&lt; Test.rtest &lt;&lt; "\n";
      return 0;
  }
  </code></pre>
  
  <p>I received these messages:</p>
  
  <pre><code>warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
       int&amp; rtest = test;
  
  In function ‘int main()’: error: expected primary-expression before ‘.’ token
       std::cin &gt;&gt; Test.rtest;
  
  error: expected primary-expression before ‘.’ token std::cout &lt;&lt; "\n" &lt;&lt; Test.rtest &lt;&lt; "\n";
  </code></pre>
  
  <p>Why am I getting these? Is what I am trying to do possible? If so, how can I do it?</p>