title: Best way to alias methods of member object? "Passthrough methods"
body: <p>Consider the following code:</p>
  
  <pre><code>class Rectangle
  {
  public:
      // Constructors
      Rectangle(){ init(0,0); }
      Rectangle(int h, int w){ init(h,w); }
  
      // Methods
      void init(int h, int w)
      {
          _h = h;
          _w = w;
      }
  
      // Getters / Setters
      double get_h(void){ return _h; }
      double get_w(void){ return _w; }
      void set_h(double h){ _h = h;  }
      void set_w(double w){ _w = w;  }
      std::string get_name(void){ return _name; }
      void set_name(std::string name){ _name = name; }
  
  private:
      // Private Members
      int _h, _w;
      std::string _name;
  };
  
  class House
  {
  public: 
      // &lt;BEGIN PASSTHROUGHS&gt;
      std::string get_b_name(void){ return _base.get_name() };
      std::string get_r_name(void){ return _roof.get_name() };
      void set_b_name(std::string name){ _base.set_name(name); }
      void set_r_name(std::string name){ _roof.set_name(name); }
      // &lt;/END PASSTHROUGHS&gt;
  
  private:
      // Private Members
      Rectangle _base;
      Triangle  _roof;
  };
  </code></pre>
  
  <p>This code works fine.</p>
  
  <p>My question deals with the "passthrough" functions in the House class, enclosed by the PASSTHROUGHS tags.  Is this the best way to do this?  The arguments and return types will always match and there is no "intelligence" in these passthrough functions other than to make things cleaner and more straightforward.</p>
  
  <p>My instinct would be something like one of the following:</p>
  
  <pre><code>get_b_name = _base.get_name;
  
  // OR
  
  std::string get_b_name(void) = _base.get_name;
  </code></pre>
  
  <p>... but neither seem to work unfortunately and it was only wishful thinking in the first place.  If there are no easier options, telling me that is fine too.  Thanks!</p>