Topic: Don't derive from a class with a private virtual base class?
Author: nid_oizo@yahoo.com_removethe_ (Nicolas Fleury)
Date: Sat, 1 Feb 2003 00:31:36 +0000 (UTC) Raw View
Does it mean we will be able to do that to block inheritance?
class Final {};
class FinalClass : virtual private Final {}; // Can't derive from
Nicolas Fleury wrote:
> Hi,
>
> I've found the following C++ Standard Core Language Closed Issue:
> http://www.comeaucomputing.com/iso/cwg_closed.html#7
>
> I don't like at all the idea of not being able to derive from a class
> with a private virtual base class. It's a pattern we commonly use where
> I work, particularly with an Observer class. The virtual private
> inheritance allows us to store only one observer (and its lists of
> observed objects) for one object.
>
> I may not understand the issue well; maybe someone could explain me why
> it would be bad.
>
> I was also surprised to see this issue closed (note: I know nothing
> about how the Committee process), considering the recent huge thread
> about blocking inheritance and the fact that I don't remember reading
> anything about this.
>
> By the way, g++ 3.2 accepts the test case provide in the link in
> addition to the other compilers mentioned.
>
> Regards,
>
> Nicolas
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: nid_oizo@yahoo.com_removethe_ (Nicolas Fleury)
Date: Sat, 1 Feb 2003 00:37:13 +0000 (UTC) Raw View
I guess I made the mistake of not asking directly any question in my post...
Does it mean that in future C++ we will be able to block inheritance by
doing something like the following code?
class Final {};
class MyFinalClass : private virtual Final, ...
If yes, what's the difference with a not-virtual private base class?
Thanks for insight.
Nicolas Fleury
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: nid_oizo@yahoo.com_removethe_ (Nicolas Fleury)
Date: Fri, 24 Jan 2003 20:09:23 +0000 (UTC) Raw View
Hi,
I've found the following C++ Standard Core Language Closed Issue:
http://www.comeaucomputing.com/iso/cwg_closed.html#7
I don't like at all the idea of not being able to derive from a class
with a private virtual base class. It's a pattern we commonly use where
I work, particularly with an Observer class. The virtual private
inheritance allows us to store only one observer (and its lists of
observed objects) for one object.
I may not understand the issue well; maybe someone could explain me why
it would be bad.
I was also surprised to see this issue closed (note: I know nothing
about how the Committee process), considering the recent huge thread
about blocking inheritance and the fact that I don't remember reading
anything about this.
By the way, g++ 3.2 accepts the test case provide in the link in
addition to the other compilers mentioned.
Regards,
Nicolas
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]