O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Second Edition by Brian Overland

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

11. Introducing Classes: The Fraction Class

It’s time to turn toward a new vista: the world of classes and objects. Up until now, you’ve read about features that are either already in the old C language or represent small refinements to that language.

The major feature of C++ is that it adds this new capability—classes—to the C language. (There’s also another big feature called templates we’ll get to in Chapter 16.) And to understand what classes are all about, we’ll develop a class that’s particularly useful and not too difficult to write: the Fraction class.

Object Orientation: Quasi-Intelligent Data Types

Before embarking on the journey of creating a Fraction class, let me say a few words as to why the journey is necessary. In other words, ...

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