Defining the abstract base class

The abstract base class defines the member functions that you plan to call remotely. This class does not contain actual implementations; all member functions are pure virtual functions.

Both the caller class and the implementation derive from this class. The caller class overrides the member functions to implement caller stubs. The dispatcher implementation class overrides the member functions to define the implementation (the code that performs the task in the remote location).

In the calculator example, MAdditionProtocol is the abstract base class. This class defines two member functions--Add and AddOne.

      class MAdditionProtocol : public MCollectible {
        public:
          VersionDeclarationsMacro(MAdditionProtocol);
        public:
                              MAdditionProtocol();
                              ~MAdditionProtocol();
                              
          virtualTStream&operator>>=(TStream& toStream) const;
          virtualTStream&operator<<=(TStream& fromStream);
                              
          
    virtual long    Add(long num1, long num2) = 0;
          virtual void    AddOne(long& num) = 0;
          
        private:
          enum {kOriginalVersion};
      };AddStub

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker