Navigation:  Programming Cookbook > Creating COM Components > Building a COM component >

Define Implementation Class

Previous pageReturn to chapter overviewNext page

At this point we are ready to start coding in Smalltalk (though of course Dolphin wrote some Smalltalk for us as in the last step). We begin by defining the server implementation class as a subclass of COMInterfaceImp. If we are implementing a dual interface, derived from IDispatch, then we normally subclass AXDualImp, otherwise, for a custom interface derived directly from IUnknown, we would subclass COMInterfaceImp directly.

IRandomStream is a dual interface (because we want scripting clients to be able to use it), so we subclass AXDualImp:

AXDualImp subclass: #COMRandomStream

       instanceVariableNames: ''

       classVariableNames: ''

       poolDictionaries: ''

       classInstanceVariableNames: ''

 

Bear in mind that this will not match the definition of the class in your image if it is still installed. At the moment we don’t know what instance variables are going to be needed to implement the component, so we haven’t defined any.