The enumeration type is a new feature of the JDK5.0. Sun introduced a new keyword enum to define an enumeration class. The following is a definition of a typical enumeration type:
Java code public enum color{Red,blue,black,yellow,green}
Obviously,
The enum and set columns provide an efficient way to define columns that can contain only the given set of values. However, from MySQL 5.0.2, enum and set are not actual constraints. The reason for this is the same as not valuing not NULL.
The enum
An introduction to the type of Enum
The enumeration type (enumerated type) appears early in the programming language and is used to include a similar set of values into one type. The name of this enumeration type is defined as a unique type
The following methods are used to simulate an enum: (Sensory method is simple and practical)# Way1Class Directions:Up = 0Down = 1left = 2Right =3Print Directions.down# Way2Dirup, Dirdown, dirleft, dirright = Range (4)Print Dirdown# WAY3Import
Enums enumerations are value types, and data is stored directly on the stack, rather than by using references and the isolation of real data.
(1) By default, the first variable in the enumeration is assigned a value of 0, and the value of the other
Usage One: Constants
Before JDK1.5, we defined constants as: public static fianl ... Now that you have enumerations, you can group related constants into an enumeration type, and enumerations provide more methods than constants.
public enum Color {
It is easy to register a C + + enumeration in LUA code, just like registering a global variable. We use the enumeration name as a namespace to avoid conflicting enumeration registrations. The registered enumeration is stored in the Global
In the development process, some state representation is used to the enumeration type, so how to bind the enum type directly to ListControl (DropDownList) is the subject of this time, the nonsense is not much to say, the direct code:First look at
the method of using enumeration types is generally defined as follows:enumenum_type_name{enum_const_1, enum_const_2, ... Enum_const_n} enum_variable_name; Note: Enum_type_name is a custom data data type name, and Enum_variable_name is a variable of
How enum enum types are defined and some usage#include using namespace Std;int main () {enum tot{zero, one, I, three, four, five};//0,1,2,3,4,5tot to1 ; to1 = Five;switch (to1) {case 0:cout Definition of enum enum type
For an enum I just started to think it was a bunch of strings, as a string set in. But it's much more than that, for example, it can add methods, like classes.
The public enum Enumfunction {
//bracket contains parameters, which is equivalent to
Enum for Python and enum for python
Enumeration is a common function. Let's look at Python enumeration.
from enum import EnumMonth = Enum('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))
Enumeration
The enumeration classes are new after Java 5, can be used to encapsulate constants, and can also provide some methods for the use of constants.Defines the syntax for an enumeration class: Public enum enumname{ //must be placed on the
The enumeration is defined in MSDN as:
The enum keyword is used to declare an enumeration, a unique type consisting of a set of named constants called an enumerated list of columns. Each enumeration type has an underlying type, which can be any
1 character types Char and varchar#官网: https://Dev.mysql.com/Doc/Refman/5.7/En/Char. html# Note: The parameters in char and varchar brackets refer to the length of the character #char type: fixed length, simple rough, wasted space, fast access speed
The enum type is defined as follows:
Public
Enum
Interactivetype
{Nothing = 1 , // Do nothing Email = 2 , // Sent by email Jiwai = 3 // Sent back via SMS (updated via API, and then sent back through the
The relevant guidance on the enum design of c # is discussed in related articles on the Internet:
Design Guidelines update: Enum Design
Chinese:C # idioms: Enum or enum class (enumeration class)
The enum operation usually involves the in-place
From: http://blog.csdn.net/erazy0/article/details/5463837
To illustrate how to use this technique, let's give a simple example. For example, to develop a network program, you need to count the number of packets of various network protocols.
★Version
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.