title: C++ Method chaining on constructor
body: <p>I'm trying allow for method chaining on the Constructor and I have ran into the same problem on this <a href="https://stackoverflow.com/questions/2877175/c-method-chaining-including-class-constructor">C++ method chaining including class constructor</a> and I have tried the suggested answers but still getting the same error. My code is below:</p>
  
  <pre><code>class Signal {
  
  public:
      Signal() { }
  
      Signal&amp; Emphasize() {
  
          return *this;
      }   
  
  };
  enum ReadType { NATIVE = 0, DOUBLE, };
  
  class Wav : public Signal {
  
    public:
  
            Wav(string fileName, ReadType type) {
  
      }   
  
  };
  </code></pre>
  
  <p>I have tried calling from the following:</p>
  
  <pre><code>Wav* wave = new Wav("asf", DOUBLE).Emphasize();
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>Wav wave = Wav("asf", DOUBLE).Emphasize();
  </code></pre>
  
  <p>I don't know whether the actual process is possible since "Emphasize" it's not a constructor but hopefully I will be allowed to access it. What could I be doing wrong here for this not to work?</p>
  
  <p>Hope someone can help :)    </p>
  
  <p>UPDATE:</p>
  
  <p>I put "Emphasize()" as a class member inside "Wav" and it worked, how I wanted. BUT does anyone know of a way I can access this member inside "Signal" without having to place the class member inside of "Wav"?</p>
  
  <p>UPDATE:</p>
  
  <pre><code>class Signal {
  
  public:
      Signal() { }
  
      Signal* Emphasize() {
          return this;
      }
   };
   enum ReadType {
  
          NATIVE = 0, DOUBLE,
      };
  
   class Wav : public Signal {
  
     public:
        Wav(string fileName, ReadType type) {
  
         }    
   };
  
   int main(int argc, char *argv[]) {
  
    Wav* wave = new Wav("asf", DOUBLE)-&gt;Emphasize();
   }
  </code></pre>