how to make a constructor to return in between?
<p>I mean something like this </p>

<pre><code>#include &lt;iostream&gt;

    using namespace std;

    class A{
            int a, b;

            public:
            A(int a,int b, int *c);
    };

    A::A(int x, int y, int *errcode)
    {
            *errcode = 0;
            a=x;
            b=y;

            // check for some error conditions
            // and return from the constructor
            if (y==0)
            {
              *errcode=-1;
              return;
            }

            // some more operations

            return;
    }

    int main() {

            int errorcode;

            A(1,0,&amp;errorcode);

            cout &lt;&lt; errorcode;

            return 0;
    }
</code></pre>
