Alf P. Steinbach wrote:
2. Is this a good way to go about things or should one make ASocket an
abstract base class ? ( thinking in terms of interface based
programming )
AFAICS you don't provide enough information to answer that.
3. The Inheritance topic in C++ FAQ slightly confuses me .. It talks a
lot about protected inheritance .. should that be a concern for such a
situation.
AFAICS you don't provide enough information to answer that.
okay, my bad.
ASocket has the following methods -- openSocket () , closeSocket () ,
bind() which are common to both the derived classes and would remain
the same for both of them. AListener would have specific methods to
listen to incoming UDP packets and ATalker would have the ability to
broadcast such packets.
Though this is probably a one time coding effort, but was thinking if
lets say some time later the class needs to add TCP functionality , so
then requirements would change, the openSocket and closeSocket function
would require different arguments. In what way should my thought
process and design be to forsee future extensibility ? ( Thinking in
terms of direction inversion principle ) and thus asking about abstract
class ?
Also the Atalker and Alistener class would be used by other classes as
in a composition relationship ? This is where the c++ FAQ confuses me
e.g. "I've been told to never use protected data, and instead to always
use private data with protected access functions. Is that a good
rule?". Am not sure if all the FAQ are relevant here ?
thanks again .