|
||
To write an interface implementation:
derive a class from the interface definition
implement the normal object creation functions: i.e. NewL()
/ConstructL()
for CBase
-derived classes. If the implementation is to receive data from the client (the aConstructionParameters
parameter in REComSession::CreateImplementationL()
), then the creation function must take a TAny*
parameter, through which ECom passes that data.
implement the pure virtual functions defined by the interface definition, to provide services to clients in an appropriate way
In short, there is little difference from implementing any concrete class based on an abstract base.
The following example declares an implementation of the CExampleInterfaceDefinition
interface.
class CExampleIntImplementation : public CExampleInterfaceDefinition
{
public:
// Two-phase constructor
static CExampleIntImplementation* NewL();
// Destructor
~CExampleIntImplementation();
// Implement CExampleInterfaceDefinition
void DoMethodL();
private:
void ConstructL();
};