|
Boost : |
From: Vladislav Lazarenko (snail_at_[hidden])
Date: 2006-04-07 12:23:47
Sebastian Redl wrote:
> Interesting idea. Any particular reason why this inheritance is virtual?
> sealed_impl being a template should be rare to duplicate as a base, and
> having no data members or virtual functions, it should be irrelevant
> even if it was duplicated. On the other hand, you introduce the troubles
> that come with virtual inheritance.
>
> Sebastian Redl
>
Dear Sebastian Redl, thank you for your interest.
Template class "sealed" inherits "sealed_impl" by virtual to
require all classes that will inherit from class "sealed" to call the
constructor of "sealed_impl".
All classes in the hierarchy are required to call "sealed_impl" constructor, but
it is allowed only for two classes, the "sealed" (it was made just to keep code
pretty) and that class who will inherit from "sealed". If you will try to
inherit from class that already inherits "sealed", you will get error on
compilation.
It is impossible to implement this thing without virtual inheritance and friend
class. I know that virtual inheritance may cause problems in generally, but I
see no possible problems with this code.
Any suggestions and other solutions are welcome!
Thank you.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk