[webkit-dev] Interface design question

Siva B bvs.siva at yahoo.com
Thu Oct 11 13:19:39 PDT 2012


      Have a design related question and hope to hear some insights.

      Interfaces using abstract classes impose restriction(s) on it's derived implementations.
        - The most widely used restriction is to IMPLEMENT Function(s)

        Is it permissible to have similar kind of  restriction for any data members in the interface?
        In a way that if some one wants to implement the interface it also must initialize certain variable.       

        Say for a TCP/IP it absolutely necessary to have
 peer's IP address and Port number.
        So, is wise to impose a restriction to pass above variable to initialize the class.

        class IP4Connection
                    explicit IP4Connection( string ip, uint port);
                    virtual int send() = 0;
                    virtual int listen() = 0;
                    virtual int reconnect() = 0;
                    std::string ip;
                    uint port;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20121011/4ebe6766/attachment.html>

More information about the webkit-dev mailing list