It was stated earlier that an interface definition serves two purposes:
So, an interface definition class is a normal abstract class plus some implemented functions that use ECom to create object instances. The class can have any base class: for example,
for CBase -based classes, you can implement the object construction in NewL() and destruction in the destructor
for a RHandleBase -based class, the Open() and Close() functions would be the natural place to conceal the implementation instantiation and destruction
The class must always declare a private UID member. This is set on object instantiation and is used by ECom to identify the instance when object destruction occurs.
The following shows an example segment of a interface definition class that derives from CActive (i.e. it is an active object).
class CExampleInterfaceDefinition : public CActive { public: // Wraps ECom object instantitation static CExampleInterfaceDefinition* NewL(); // Wraps ECom object destruction virtual ~CExampleInterfaceDefinition(); // Interface service virtual void DoMethodL() = 0; ... private: // Instance identifier key TUid iDtor_ID_Key; };
The class:
Has a pure virtual method: this means that this class must be a base, although a NewL() usually implies that there is no derivation from this class.
Does not need a constructor, private or otherwise, because for an abstract base there is no requirement for construction.
Has no ConstructL() to accompany the NewL(), construction isn't going to happen in the standard two-phase pattern, but through ECom.