J
jeffc
Rolf Magnus said:And while we're at it, add
another keyword 'pure' so we can get rid of that strange
"pseudo-inizialize with 0 to make it pure virtual" syntax.
Yeah, that's a no-brainer.
Rolf Magnus said:And while we're at it, add
another keyword 'pure' so we can get rid of that strange
"pseudo-inizialize with 0 to make it pure virtual" syntax.
Rolf Magnus said:Karl Heinz Buchegger wrote:
I'd call them 'virtual' and 'override'. And while we're at it, add
another keyword 'pure' so we can get rid of that strange
"pseudo-inizialize with 0 to make it pure virtual" syntax.
Rob said:Richard Herring wrote in in
comp.lang.c++:
Yes, but that is a quality of the base class, a derived type shouldn't
(need to) repeat that statement of intent, unless it has a real need,
i.e. it intends to manipulate it virtually itself.
If that were possible then derived wouldn't be a base, so inheritance
would be inappropriate.
That cuts both ways. Since it *is a* base, it should declare everythingThe derived class *is a* base, anyone further deriving should expect
it to behave like the base and should read the base clases documentation.
But it class can't prevent further derivations from manipulating it
virtually, whether that was "intended" or not.
I think this is where we differ: you see the virtual declaration as
just a statement about the base class,
whereas I think it's part of the
contract imposed transitively on _all_ subsequently derived classes,
whether they like it or not.
From that POV when they repeat the
redundant "virtual" they are acknowledging that obligation: derived
"is-a" base, and should therefore state which functions are virtual.
It would be a new base for derivation, in which the fact that it was
actually derived from something else was a concealed implementation
detail.
Siemel Naran said:That would be tough to do that as the = 0 is firmly embedded into the
language
I also liked a way to make the function
inherited as pure virtual, in order to force derived class authors to define
the function, for which two equal signs seems appropriate, for example Base
* clone() const == 0.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.