Boost logo

Boost :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2006-05-26 07:59:12


On May 26, 2006, at 7:26 AM, Maarten Kronenburg wrote:
> Every unsigned integer is an integer,

No.

A (signed) integer will have a negation operator, such that 0 - x = -
x, x + -x = 0, etc. An unsigned integer will not have this operator.

> and every modular integer is an integer.
> So therefore in my opinion public inheritance
> can be used.
> Also I think there is no other way of defining
> an unsigned_integer.

Sure there is. What we want is to share nearly all of the
implementation details without providing exactly the same interface.
You can do that with a common base class (that is neither integer
nor unsigned_integer).

        Doug


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