Public new private constructor
<p>When I try compiling the following:</p>

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

class Test
{
public:
    void* operator new (size_t num);
    void operator delete (void* test);
    ~Test();
private:
    Test();
};

Test::Test()
{
    std::cout &lt;&lt; "Constructing Test" &lt;&lt; std::endl;
}

Test::~Test()
{
    std::cout &lt;&lt; "Destroying Test" &lt;&lt; std::endl;
}

void* Test::operator new (size_t num)
{
    ::new Test;
}

void Test::operator delete(void* test)
{
    ::delete(static_cast&lt;Test*&gt;(test));
}

int main()
{
    Test* test = new Test;
    delete test;
}
</code></pre>

<p>I get :</p>

<pre><code>$ g++ -o test test.cpp
test.cpp: In function ‘int main()’:
test.cpp:14: error: ‘Test::Test()’ is private
test.cpp:36: error: within this context
</code></pre>

<p>If the new is a member function, why can it not call the private constructor?</p>

<p><strong>Edit:</strong>
My idea is to create a class that can only be instantiated on the heap using totally standard syntax. I was hoping since new is a data member, it could call the private constructor but since new is not used for stack objects, you would not be allowed to create the object on the stack.</p>
