Home > Back-end > Classes are defined in the enumeration members for the data
Classes are defined in the enumeration members for the data
Time:10-04
The class DataType { . Private: Enum type {type_int, type_char type_float}; The union { Int num_int; Char num_char; Float num_float; }; };
Defines the private data members in the class type, enumeration type but compile error [error] enum DataType: : type 'is not a non - static data member of' DataType '
According to put the enumeration name later in the book, instead of enum {type_int type_char, type_float} type can What is the difference between before and after the enumeration name, please?
CodePudding user response:
Front is the representative of a type name
CodePudding user response:
No problem, VS2015 c + + environment
class DataType { Private: Enum type {type_in, type_char type_float}; The union { Int num_int; Char num_char; Float num_float; }; }; Int main () { return 0; }