You are previewing Code Complete, Second Edition.

Code Complete, Second Edition

Cover of Code Complete, Second Edition by Steve McConnell Published by Microsoft Press

Creating Your Own Types (Type Aliasing)

Creating Your Own Types (Type Aliasing)

Programmer-defined data types are one of the most powerful capabilities a language can give you to clarify your understanding of a program. They protect your program against unforeseen changes and make it easier to read—all without requiring you to design, construct, or test new classes. If you're using C, C++, or another language that allows user-defined types, take advantage of them!


In many cases, it's better to create a class than to create a simple data type. For details, see Chapter 6.

To appreciate the power of type creation, suppose you're writing a program to convert coordinates in an ...

The best content for your career. Discover unlimited learning on demand for around $1/day.