Tutorial by Examples

Introduces the definition of a class type. class foo { int x; public: int get_x(); void set_x(int new_x); }; Introduces an elaborated type specifier, which specifies that the following name is the name of a class type. If the class name has been declared already, it ca...
Interchangeable with class, except for the following differences: If a class type is defined using the keyword struct, then the default accessibility of bases and members is public rather than private. struct cannot be used to declare a template type parameter or template template parameter; onl...
Introduces the definition of an enumeration type. enum Direction { UP, LEFT, DOWN, RIGHT }; Direction d = UP; C++11 In C++11, enum may optionally be followed by class or struct to define a scoped enum. Furthermore, both scoped and unscoped enums can have their unde...
Introduces the definition of a union type. // Example is from POSIX union sigval { int sival_int; void *sival_ptr; }; Introduces an elaborated type specifier, which specifies that the following name is the name of a union type. If the union name has been declared alread...

Page 1 of 1