The
intent of this chapter is to show you how easy object-oriented programming can
be –
if
someone else has gone to the work of defining the objects for you. In that
case, you include a header file, create the objects, and send messages to them.
If the types you are using are very powerful and well-designed, then you
won’t have to do very much work and your resulting program will also be
powerful.
In
the process of showing the ease of OOP when using library classes, this chapter
also introduced some of the most basic and useful types in the Standard C++
library: the family of iostreams (in particular, those that read from and write
to the console and files), the
string
class, and the
vector
template. You’ve seen how straightforward it is to use these and can now
probably imagine many things you can accomplish with them, but there’s
actually a lot more that they’re capable of
[19].
Even though we’ll only be using a limited subset of the functionality of
these tools in the early part of the book, they nonetheless provide a very
large step up from the primitiveness of learning a low-level language like C
– and while learning the low-level aspects of C is very educational,
it’s also time consuming. In the end, you’ll be much more
productive if you’ve got objects to manage the low-level issues. After
all, the whole
point
of OOP is to hide the details so you can “paint with a bigger brush.”
However,
as high-level as OOP tries to be, there are some fundamental aspects of C that
you can’t avoid knowing, and these will be covered in the next chapter.
[19]
If you’re particularly eager to see all the things that can be done with
these and other Standard library components, see [[ location of $20 C++
standard ]] or [[ www.dinkumware.com]]