Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to implement a polymorphic interface DLL

The following code fragments show a simple implementation of a polymorphic interface DLL. The DLL being implemented is the one whose interface is defined by the CMessenger class.

This example implementation issues a greeting in French.


The concrete class declaration

Declare a concrete class, called CFrenchMessenger, as follows:

class CFrenchMessenger : public CMessenger
      {
public:
    virtual void ConstructL(CConsoleBase* aConsole, const TDesC& aName);
    virtual ~CFrenchMessenger();
    virtual void ShowMessage();
    };

[Top]


Notes:

[Top]


Implementation

Start the implementation code as follows:

GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
    {
    return(KErrNone);
    }


EXPORT_C CMessenger* NewMessenger()
    {
    return new (ELeave) CFrenchMessenger;
    }

[Top]


Notes: