Friday, July 27, 2007

Prevent object being created on stack

In Symbian, sometimes we don't want the calling function to create a object of your class on stack, because the stack resource is rare. Is there any way we can restrict do this?

Answer is Yes.

We should make class destructor private, rather than public or protected.

Example

class CTest : public CBase
{
private:
~CTest ();
}

No comments:

stats counter