O'Reilly logo

Imperfect C++ Practical Solutions for Real-Life Programming by Matthew Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 29. Arithmetic Types

In section 13.3 we looked at extending the integer types provided by C++ in the form of the uinteger64 and sinteger64 types. What we'll be trying to see is whether we can create a type that can genuinely and completely integrate into the language such that it can be used as we would use any of the built-in integer types. (The imperfect results of these efforts are included on the CD.)

Class Definition

Before we get stuck into the minutiae, we'll just take a look at the class definition. I decided, in order to avoid confusion with the two extant member variables lowerVal and upperVal, to use protected inheritance and derive a new type UInteger64. This is so we can cheat and use a union of uinteger64 and a uint64_t in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required