Typedef is a language construct in C and therefore also in C++.
It has two main purposes:
- To name a complicated (composite) type with a simpler name
- To hide an implementation detail from other parts of implementation - as a handle where the actual type can easily be changed.
The last is especially important in C++ typedef
, where a typedef can be a class member.