Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-04 07:34:17


From: "Schoenborn, Oliver" <Oliver.Schoenborn_at_[hidden]>

> > warning: conversion to a base class will never use a type conversion
> > operator.
> >
> > I guess that pretty much explains things, and I guess I can understand
> > why. I guess that means that if you want implicit
> > conversion, you need public inheritance. That doesn't seem so
> > bad to me, but maybe others disagree.
>
> I disagree Dave. For one thing, you don't need any inheritance whatsoever
to
> get implicit conversions.

True.

> Secondly, I could see why public inheritance would
> disallow implicit conversion to the base class, but I fail to see why
> NON-public inheritance would. Indeed the conversion is public but the
base
> is not, so it should be doable. What is just an oversight of the
standards?

Probably not. Accessibility and visibility are orthogonal in C++. In other
words, privacy never affects what action a piece of code is trying to take.
I think that was a good choice; it helps to keep things predictable, and
changing it just for implicit conversions to a private base would be a bad
idea.

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk