Re: Testing Program Question
"James Kanze" <james.kanze@gmail.com> wrote in message
news:d8fd8df4-2c31-4492-b0fa-f6d60e9caab3@t23g2000yqt.googlegroups.com...
On Mar 1, 12:24 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
Once you accept that abstract interfaces (which contain
public pure virtual functions) are fine all bets are off
and this rule of yours (and Herb's) falls over.
Ignoring the fallacy of begging the question, it is totally
ignorant to claim that "abstract interface" == "*public*
pure virtual functions". Are you sure you want to make that
claim? Here is an abstract interface
class Foo
{
public :
void func ( ) { implFunc() ; }
protected :
virtual void implFunc ( ) = 0 ;
} ;
Notice there is no *public* pure virtual.
You know, really, do think it is that simple? Do think that
all these experts who have actually *thought* (as opposed to
just *felt*) about this topic forgot abstract bases? Do you
think all it takes if for Leigh to wave "abstract
interfaces" in their face and then all their reasoning just
"falls over"? Really man, get ahold of yourself. Don't be
so vociferously ignorant. At least learn about a topic
before publicly flailing and crying about it.
An abstract interface (or "callback class") is just that: an
interface, it never contains any code so adding a non-virtual
wrapper is both retarded and pointless.
Not all abstract interfaces are callbacks. It would help in the
discussion if you didn't contuously mix different concepts. An
abstract interface defines a common interface to a set of
derived classes; in order for users to be able to program
against that interface, it must define a contract, in terms of
pre- and post-conditions. Traditionally, this has been done in
documentation; implementing it in the form of asserts in the
code is more convenient and more effective. To do so, however,
requires that the virtual functions be private or protected.
--
James Kanze
This what I mean by an abstract interface, it is not a fuzzy concept but
well defined:
class an_abstract_interface
{
public:
virtual void function1() = 0;
virtual void function2() = 0;
};
It (abstract interface) is nothing more and nothing less: it contains no
code or data so it is impossible for it to have pre/post conditions
(invariant check). A "callback class" is a term somebody else used which I
just repeated to try and get my point across. A class which contains at
least one pure virtual but also normal functions/code and data for which an
invariant check can be made is usually known by the term "mixin" not
"interface".
/Leigh