?? 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 + -