RAD Studio
ContentsIndex
PreviousUpNext
Type Categories

Provides information on C++ type categories. 

The four basic type categories (and their subcategories) are as follows:

Aggregate   Array
   struct
   union
   class (C++ only)
Function
Scalar
   Arithmetic
   Enumeration
   Pointer
   Reference (C++ only)
void

Types can also be viewed in another way: they can be fundamental or derived types. The fundamental types are void, char, int, float, and double, together with short, long, signed, and unsigned variants of some of these. The derived types include pointers and references to other types, arrays of other types, function types, class types, structures, and unions. 

A class object, for example, can hold a number of objects of different types together with functions for manipulating these objects, plus a mechanism to control access and inheritance from other classes. 

Given any nonvoid type type (with some provisos), you can declare derived types as follows:  

Declaring Types  

Declaration 
Description 
type t;  
An object of type type  
type array[10];  
Ten types: array[0] - array[9]  
type *ptr;  
ptr is a pointer to type  
type &ref = t;  
ref is a reference to type (C++)  
type func(void);  
func returns value of type type  
void func1(type t);  
func1 takes a type type parameter  
struct st {type t1;type t2};  
structure st holds two types  

Note: type& var, type &var, and type & var are all equivalent.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!