Topic: disallow virtual
Author: Valentin Bonnard <Valentin.Bonnard@free.fr>
Date: 2000/11/14 Raw View
Andrew J Robb wrote:
> class A
> {
> public:
> virtual void fred();
> };
>
> class B : public A
> {
> public:
> void fred();
> };
>
> The above example is an obscure way of declaring that B::fred() is virtual.
> And may be changed in B by changing A::fred() from being virtual. This is
> not clear.
>
> Please, consider making "virtual" mandatory in derived classes if a method
> is already virtual in a base class.
class A
{
public:
virtual void fred();
};
class B : public A
{
public:
virtual void fred();
};
The above is an obscure way of declaring that B::fred() overrides
A::fred(). And may be changed to mean that B::fred() is a new virtual
function by changing A::fred() from being virtual. This is not clear.
Please, consider making "virtual" disallowed in derived classes if a
method is already virtual in a base class.
--
Valentin Bonnard
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]