[webkit-dev] Interface design question

2012-10-11 Thread Siva B
Hello,

  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)

  Question:
    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.   

 Ex:
 
    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
        {
               public:
                    explicit IP4Connection( string ip, uint port);
                    virtual int send() = 0;
                    virtual int listen() = 0;
                    virtual int reconnect() = 0;
  
 protected:
    std::string ip;
    uint port;
        };

Thanks,
Siva.___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Interface design question

2012-10-11 Thread Siva B
I'am Sorry.

Siva.





 From: Ryosuke Niwa rn...@webkit.org
To: Siva B bvs.s...@yahoo.com 
Cc: webkit-dev@lists.webkit.org webkit-dev@lists.webkit.org 
Sent: Thursday, October 11, 2012 2:43 PM
Subject: Re: [webkit-dev] Interface design question
 

webkit-dev doesn't seem like an appropriate place to discuss this topic unless 
you have a specific WebKit patch or bug that relates this design question.


On Thu, Oct 11, 2012 at 1:19 PM, Siva B bvs.s...@yahoo.com wrote:

Hello,

  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)

  Question:
    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.   

 Ex:
 
    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
        {
               public:
                    explicit IP4Connection( string ip, uint port);
                    virtual int send() = 0;
                    virtual int listen() = 0;
                    virtual int reconnect() = 0;
  
 protected:
    std::string ip;
    uint port;
        };

Thanks,
Siva. 
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-dev