title: Do class functions/variables have to be declared before being used?
body: <p>So I was learning about classes and I stumbled upon something I found was quite awkward to me.</p>
  
  <pre><code>class Nebla 
  {
      public:
          int test()
          {
              printout();
              return x;
          }
  
          void printout()
          {
              printout2();
          }
  
      private:
          int x,y;
          void printout2()
          {
              cout&lt;&lt;"Testing my class";
          }
  };
  </code></pre>
  
  <p>I found that in a class I can use functions before I declare them (prototype them)</p>
  
  <blockquote>
    <p>You can see I used <code>printout()</code> , <code>printout2()</code> before decleration.</p>
  </blockquote>
  
  <p>And I can use variables also before declaring them</p>
  
  <blockquote>
    <p>You can see I did <code>return x</code>; before declareing x.</p>
  </blockquote>
  
  <p>Why can I use functions and variables in classes before declaration but outside the class if I do that, I get an error?</p>
  
  <p>Thanks</p>