title: Some errors appeared during apply a practical example to Builder design pattern
body: <p>I have written a code which applies the "Builder" design pattern but some errors appeared:</p>
  
  <p><a href="https://i.stack.imgur.com/6s1b9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6s1b9.jpg" alt=""></a></p>
  
  <p>The code:</p>
  
  <pre><code>class Builder {
  public:
      int m_suger;
      int m_cup;
      string m_flavour;
  
      Builder* sugar(int sugar) {
          this-&gt;m_suger = sugar;
          return this;
      }
      Builder* cup(int cup) {
          this-&gt;m_cup = cup;
          return this;
      }
      Builder* flavour(string flavour) {
          this-&gt;m_flavour = flavour;
          return this;
      }
      Tea* build() {
          return new Tea(this);
      }
  };
  
  class Tea {
  public:
      int m_suger;
      int m_cup;
      string m_flavour;
  
      Tea(Builder* b) {
          m_suger = b-&gt;m_suger;
          m_cup = b-&gt;m_cup;
          m_flavour = b-&gt;m_flavour;
          cout &lt;&lt; "Hot " &lt;&lt; b-&gt;m_cup &lt;&lt; " cup of tea is comming!, with " &lt;&lt; b-&gt;m_flavour &lt;&lt; endl;
      }
  };
  
  int main(int argc, char *argv[]) {
      Tea* mintTea = new Builder()-&gt;cup(2)-&gt;sugar(3)-&gt;flavour("mint")-&gt;build();
      return 0;
  }
  </code></pre>