intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Chapter 9 Quick Reference

Chia sẻ: Nghia Tuan | Ngày: | Loại File: PDF | Số trang:1

59
lượt xem
4
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

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ữ.

Chủ đề:
Lưu

Nội dung Text: Chapter 9 Quick Reference

  1. Chapter 9 Quick Reference To 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 the Declare 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 the Declare an name of the variable, followed by a semicolon. For example: enumeration variable Season currentSeason; Write the name of the enumeration literal name in combination with Initialize or assign the name of the enumeration type it belongs to. For example: an enumeration variable 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 Time Declare 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 the Declare a struct variable, followed by a semicolon. For example: variable Time now; Initialize or assign the variable to a struct value created by calling a Initialize or assign structure constructor. For example: a struct variable to a value Time lunch = new Time(12, 30, 0); lunch = new Time(12, 30, 0);
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2