User-Defined Types

C++ allows all the same user defined types as ANSI C, plus the class, which extends the power of the language enormously. In fact, struct and union are treated as restricted forms of the class. In the following discussion only additional possibilities in C++ are discussed.

Structured Types in C++

All structured types in C++ can be created dynamically, in a manner similar to the use of malloc() in C. The principal difference is that an operator called new replaces the functions malloc() and calloc(), while an operator called delete replaces free().

Next note in series

Back to index