Victor Bazarov said:
Again, if you intend to override other member functions, then all
member functions declared virtual are fair game. If you don't
want the programmer deriving from your file to override certain
methods, _all_you_have_ is documentation. Simple as that. No
need to discuss it any further. There is no 'final' (or any of
its potential analoques) in C++.
Okay, so I understand what I want to do cannot be done in C++, and yes that
the need for such a feature is a relatively rare. The discussion has moved
to the more philosphical note below.
C++ cannot prevent people from doing stupid things. It's rather
impossible in the language which is already as complex as C++ is.
And attempting to "simplify" it in certain areas can lead to...
...well, Java.
Of course, a compiler cannot read the mind of the coder, and too much
compiler intervension can restrict what the coder can do (e.g. garbage
collection leads to wasted CPU at the expense of coding ease). But, that
does not mean that we should give up on trying to help the coder. Especially
when systems are getting larger and more complex, with larger development
teams, programmers need all the help that they can get. What happens in a
natural language when some new thing arises in society? We evolve the
language to adequately differentiate between the new thing and what was
there before. C++ evolves very slowly, which is good -- it doesn't
incorporate every trendy feature that comes along. But, as far as the ANSI
language goes, it has been rather stagnant the last decade or so. Perhaps it
is time to start moving again.
OK, errors are almost always unintentional, I'll give you that. But
what else do you have against my statement? There is no way in hell
to make your compiler not let you, say, access class private members
if you have access to the class header, just add your 'friend'
statement there, for example. There is no way to protect from never
'delete'ing a pointer that was allocated using 'new' (although some
did implement a garbage collector for C++), or from 'delete'ing the
same pointer twice. Sacrifices have to be made. That's why machines
writing programs in C++ are still losing in numbers to people.
I guess what I am arguing is a matter of taste. One person's unintentional
error is another person's regular playing ground.
I am not going to discuss Java in a C++ newsgroup. Do you have any
other C++ question?
I think it's fair to bring up other languages in comparison to the current
one. Granted, I know that it is taboo to say the J-word in this group
.
Dave.