A class has overloaded operators new
and delete
. new
is public, delete
is private.
When constructing an instance of this class, I get the following error:
pFoo = new Foo(bar)
example.cpp(1): error C2248: 'Foo:operator delete': cannot access private member declared in class 'Foo'
But there's no call to delete
here, so what is going on in the twisted mind of the compiler? :)
- What is the reason for the error?
- Is it possible to resolve the problem without resorting to a member
CreateInstance
function?