title: Calling a Method in Constructor
body: <p>Herb Sutter mentions in one of his <a href="http://www.gotw.ca" rel="noreferrer">http://www.gotw.ca</a> articles that an object is constructed(has valid existence) only if the constructor executes completes.ie to put it in a crude way control passes beyond its final brace.</p>
  
  <p>Now consider the following code</p>
  
  <pre><code>class A
  {
    public:
    A() 
    { 
        f();
    }
  
    void f() 
    { 
        cout &lt;&lt; "hello, world"; 
    }
  
  }; 
  
  int main()
  {
     A a;
  }
  </code></pre>
  
  <p>Now from what Herb says, can't we say that since A is not completely constructed inside its constructor Calling f() inside the constructor is invalid as the "this" ptr is not ready yet.</p>
  
  <p>Still there is indeed a valid "this" inside the constructor and f() does get called. </p>
  
  <p>I don't think Herb is saying something incorrect... but guess i am interpreting it incorrectly....can some explain to me what exactly that is?</p>
  
  <p>Here is the link to the article : <a href="http://www.gotw.ca/gotw/066.htm" rel="noreferrer">http://www.gotw.ca/gotw/066.htm</a>
  It talks about exceptions from constructors. Specifically here is the extract from it on which my question is based:</p>
  
  <p>-When does an object's lifetime begin?
  <strong>When its constructor completes successfully and returns normally</strong>. That is, control reaches the end of the constructor body or an earlier return statement.</p>
  
  <p>-When does an object's lifetime end?
  When its destructor begins. That is, control reaches the beginning of the destructor body.
  <strong>Important point here is that the state of the object before its lifetime begins is exactly the same as after its lifetime ends -- there is no object, period</strong>. This observation brings us to the key question:</p>
  
  <p>We might summarize the C++ constructor model as follows:</p>
  
  <pre><code>Either:
  
  (a) The constructor returns normally by reaching its end or a return statement, and the object exists.
  
  Or:
  
  (b) The constructor exits by emitting an exception, and the object not only does not now exist, but never existed.
  </code></pre>