Saturday, May 28, 2005
18. How do I declare a TPtr or TPtr8 for definition later?
I want to initialise a TPtr later, but declare it now. How do I do this?
TPtr8 myPtr(NULL, 0);
or, for member data, in the constructor's initialization list:
CMyClass::CMyClass()
: iPtr(NULL, 0)
{}
To assign to it later, use Set() as described in 16. What does TPtrC::Set() do?. For example:
myTPtr.Set(myHBufC->Des());
iPtr.Set(someExistingBuf);
TPtr8 myPtr(NULL, 0);
or, for member data, in the constructor's initialization list:
CMyClass::CMyClass()
: iPtr(NULL, 0)
{}
To assign to it later, use Set() as described in 16. What does TPtrC::Set() do?. For example:
myTPtr.Set(myHBufC->Des());
iPtr.Set(someExistingBuf);