Skip to content

Instantly share code, notes, and snippets.

@artem78
Last active May 15, 2021 12:10
Show Gist options
  • Save artem78/499e78ef305ffcb5b20dce1b52bba717 to your computer and use it in GitHub Desktop.
Save artem78/499e78ef305ffcb5b20dce1b52bba717 to your computer and use it in GitHub Desktop.
Template of two-stage construction for C-class in Symbian OS
CClassName* CClassName::NewLC()
{
CClassName* self = new (ELeave) CClassName();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CClassName* CClassName::NewL()
{
CClassName* self = CClassName::NewLC();
CleanupStack::Pop(); // self;
return self;
}
CClassName::CClassName()
{
}
void CClassName::ConstructL()
{
// ... Add your initialisation code here ...
}
CClassName::~CClassName()
{
}
class CClassName : public CBase
{
// Constructor / Destructor
public:
static CClassName* NewL();
static CClassName* NewLC();
~CClassName();
private:
CClassName();
void ConstructL();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment