📄 towphaseconstruct.cpp
字号:
//
// Copyright (c) 2005 NEUSOFT Institute of inforamtion technology ChenDu.
// All rights reserved.
//
// TowPhaseConstruct.cpp
// example for TowPhaseConstruct
//
// Version 1.0
// by YangZongde
// 2005-9-28
#include "CommonFramework.h"
class CTest:public CBase
{
public :
TInt iVal;
};
class CSimple :public CBase
{
public:
void test( );
static CSimple* NewLC(TInt Value);
void ConstructL(TInt Value);
};
void CSimple::test( )
{
_LIT(TestIsOk,"Test is ok\n");
console->Printf(TestIsOk);
}
CSimple* CSimple::NewLC(TInt Value)
{
CSimple* self=new(ELeave) CSimple;
CleanupStack::PushL(self);
self->ConstructL(Value);
return self;
}
void CSimple::ConstructL(TInt Value)
{
CTest* test=new(ELeave)CTest;
CleanupStack::PushL(test);
test->iVal=Value;
_LIT(KFormatOK,"OK,The number is %d");
console->Printf(KFormatOK,test->iVal);
CleanupStack::PopAndDestroy();
}
LOCAL_C void doExampleL()
{
CSimple* simple1=CSimple::NewLC(10);
// CleanupStack::PushL(simple1); //the newlc has a pushl()
// CleanupStack::Pop( ); //pop if true ,else invoke panic
delete simple1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -