title: a very simple c++ oop question
body: <p>im struggling with syntax here: hopefully this question is v simple, im just miising the point.</p>
  
  <p>specifically, if i nest a class within another class, so for instance </p>
  
  <pre><code>class a
  {
      a  //the constructor
      {
          b an_instance_of_b // an instance of class b
      }
  };
  
  class b
  {
      public:
      foo()
      {
          cout &lt;&lt; "foo";
      }
  };
  </code></pre>
  
  <p>When i try to access this method within B by doing this:</p>
  
  <pre><code>a an_instance_of_a; //declare an instance of a
  an_instance_of_a.an_instance_of_b.foo()
  </code></pre>
  
  <p>^^ this doesnt seem to work. this is simplified (so might be a typo here somewhere). but i know the classes are being setup fine, its just that i cant access the methods inside them if they are nested. what may i be doing wrong?</p>
  
  <p>many thanks.</p>