¿Le resultó útil esta página?
Sus comentarios sobre este contenido son muy importantes. Háganos saber su opinión.
¿Tiene comentarios adicionales?
Caracteres restantes: 1500
Exportar (0) Imprimir
Expandir todo
Este contenido no se encuentra disponible en su idioma, pero aquí tiene la versión en inglés.

Classes, Structures, and Unions

This section introduces C++ classes. Classes, which can contain data and functions, introduce user-defined types into a program. User-defined types in traditional programming languages are collections of data which, taken together, describe an object's attributes and state. Class types in C++ enable you to describe attributes and state, and to define behavior.

The following topics are included:

The three class types are structure, class, and union. They are declared using the struct, class, and union keywords (see Defining Class Types). The following table shows the differences among the three class types.

For information on managed classes and structs, see Classes and Structs.

Access Control and Constraints of Structures, Classes and Unions
Structures Classes Unions

class key is struct

class key is class

class key is union

Default access is public

Default access is private

Default access is public

No usage constraints

No usage constraints

Use only one member at a time

Adiciones de comunidad

© 2015 Microsoft