data and interfaces



howdi,

I'm curious to how people feel about this... I often create an
interface then realize that *all* subclasses will have similar data
such as, say, a list of floats so I define the interface as

class ISomeInterface
{
protected:

list<float> m_Floats;

public:

~ ISomeInterface();

virtual void SomeMethod()=0;

};


I'm sure though that the purists would exclude the data from the
intertrface class and I'm sure there must be some good reasons to do
so.

Can you provide me with any? (assuming that the data type will not
change from subclass to subclass *ever*)

thanks

.



Relevant Pages

  • Re: Question about Abstract classes and Interfaces
    ... Cylinder and Circle classes all implement the interface. ... Secondly, about Abstract classes. ... It can't be a calendar object ... you can use its name to refer to any instance of a subclass. ...
    (comp.lang.java.programmer)
  • Re: How about "pure virtual methods"?
    ... doesn't implement all the interface. ... based on the existence of "isinstance" in Python. ... subclass of a given type. ... So I conclude that a subclass, in Python, must implement the interface ...
    (comp.lang.python)
  • Re: How To Branch Java
    ... I've been told that people use source control. ... > code in sync with the production code. ... interface is used in production. ... and subclass can be tested, ...
    (comp.lang.java.programmer)
  • Re: Problems with inheritance!
    ... public void meth1; ... variates from subclass to subclass.... ... When I use an Interface, I have to write duplicated code, havent't I? ... Why particularly extend should be avoided you can read article at ...
    (comp.lang.java.programmer)
  • Re: Pickling and inheritance are making me hurt
    ... > these classes by writing other modules that subclass both of them as ... > to interface with particular search engines. ... > It seems like the problem is that _saveresults is only looking inside ... Maybe this interferes with pickling your first instance? ...
    (comp.lang.python)