Danh mục tài liệu

Chapter 9 Quick Reference

Số trang: 1      Loại file: pdf      Dung lượng: 7.13 KB      Lượt xem: 3      Lượt tải: 0    
Xem trước 1 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Chương 9 nhanh tham khảo để làm điều này từ khóa enum Viết, theo sau là tên của kiểu này, theo sau là một cặp niềng răng có chứa một danh sách bằng dấu phẩy của Khai báo một điều tra tên chữ.
Nội dung trích xuất từ tài liệu:
Chapter 9 Quick Reference Chapter 9 Quick ReferenceTo Do this Write the keyword enum, followed by the name of the type, followed by a pair of braces containing a comma-separated list of theDeclare an enumeration literal names. For example:enumeration type enum Season {Spring, Summer, Fall, Winter } Write the name of the enumeration type on the left followed by theDeclare an name of the variable, followed by a semicolon. For example:enumerationvariable Season currentSeason; Write the name of the enumeration literal name in combination withInitialize or assign the name of the enumeration type it belongs to. For example:an enumerationvariable to a value currentSeason = Season; // compile time error currentSeason = Season.Spring; // okay Write the keyword struct, followed by the name of the struct type, followed by the body of the struct (the constructors, methods, and fields). For example: struct TimeDeclare a struct {type public Time(int hh, int mm, int ss) { ... } ... private int hours, minutes, seconds; } Write the name of the struct type, followed by the name of theDeclare a struct variable, followed by a semicolon. For example:variable Time now; Initialize or assign the variable to a struct value created by calling aInitialize or assign structure constructor. For example:a struct variable toa value Time lunch = new Time(12, 30, 0); lunch = new Time(12, 30, 0);

Tài liệu được xem nhiều:

Tài liệu có liên quan: