October 1999
Beginner
304 pages
7h 11m
English
Although we’ve yet to write a class of our own, we’ve used classes extensively since Chapter 1: the string and vector classes, the iostream classes supporting input and output, and so on. In this chapter, we design and implement our own classes.
What do we know about classes from our use of them? Before we can use a class, we must make it known to the program because the class is not built into the language. Usually, we do this by including a header file:
#include <string>
string pooh[ 4 ] =
{ "winnie", "robin", "eeyore", "piglet" }; The class name serves as a type name in the same way as the built-in type names such as int and double. Often, there are multiple ways to initialize an object of a class: ...
Read now
Unlock full access