title: Instantiating a class within a class
body: <p>I'm trying to instantiate a class within a class, so that the outer class contains the inner class.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  class Inner {
      private: 
          std::string message;
  
      public:
          Inner(std::string m);
          void print() const;
  };
  
  Inner::Inner(std::string m) {
      message = m;
  }
  
  void Inner::print() const {
      std::cout &lt;&lt; message &lt;&lt; std::endl;
      std::cout &lt;&lt; message &lt;&lt; std::endl;
  }
  
  class Outer {
      private:
          std::string message;
          Inner in;
  
      public:
          Outer(std::string m);
          void print() const;
  };
  
  Outer::Outer(std::string m) {
      message = m;
  }
  
  void Outer::print() const {
      std::cout &lt;&lt; message &lt;&lt; std::endl;
  }
  
  int main() {
      Outer out("Hello world.");
      out.print();
  
      return 0;
  }
  </code></pre>
  
  <p>"Inner in", is my attempt at containing the inner within the outer, however, when I compile, i get an error that there is no matching function for call to Inner::Inner().
  What have I done wrong?</p>
  
  <p>Thanks.</p>