Protocol Class

A ProtocolClass:

    class clsFileProtocol
        {
      public:
        virtual void Open (char const *strFileName) = 0;
        virtual void Read (char *strData) = 0;
        virtual void Write (char const *strData) = 0;
        virtual ~clsFileProtocol ();
        };

That insulates its client from any knowledge of the server that eventually derives from it. The server can therefore change easily.

References: LargeScaleCppSoftwareDesign, DependencyInversionPrinciple, Java "interfaces"...


EditText of this page (last edited July 30, 2003) or FindPage with title or text search