What Is a Type?

A type is a category. One of the things that distinguishes humans is our ability to categorize. We don't see hundreds of shapes on the savanna; we see animals and trees. And we don't just see animals; we see gazelles, giraffes, elephants, water buffalo, and so forth. Humans created taxonomies, classifications, orders, groupings, divisions, and classes. In short, we think in terms of types of things.

An orange is a type of citrus. A citrus is a type of fruit. A fruit is a type of plant. A plant is a type of living thing.

Familiar types include car, house, person, and shape. In C++, a type is an object with a size, a state, and a set of abilities.

A C++ programmer can create any type needed, and each of these new types can have ...

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.