Creating New Types
You've already learned about the C++ built-in types, including int (integers) and char (characters). The type of a variable tells you quite a bit about it. For example, if you declare Height and Width to be unsigned short integers, you know that each one can hold a number between 0 and 65,535 (assuming an unsigned short integer is 2 bytes).
In addition to telling you the size, the type tells you the capabilities of the variable. For example, short integers can be added together. Thus, just by declaring Height and Width to be unsigned short integers, you know that it is possible to add Height to Width and to assign that number to another number.
The type of these variables tells you
Their size in memory
What information they ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access