Derived type

From Wikipedia, the free encyclopedia

Jump to: navigation, search

A derived type is a type given a new type but structurally the same as the original type. The purpose of this type is to create a new type name so that two values can have two distinct types in terms of name. This type matters if the type system uses a name equivalence rule (nominative type system) but does not matter if the system uses a structural equivalence (structural type system).

In C and C++, typedef can be used to create a derived type, like so:

typedef int timestamp;

(Here, timestamp is a type derived from int.)

See also: subtype.

Personal tools