c++小记
1、枚举类型的初始化或赋值,只能够通过气枚举成员或同一枚举类型的其他对象来进行。如:
enum Points {point2d = 2, point2w, point3d = 3, point3w};
Points pt3d = point3d; // ok, point3d is a Points enumerator
Points pt2w = 3; // error, pt2w initialized with int
pt2w = polygon; // error, polygon is not a Points enumerator
pt2w = pt3d; //ok, both are objects of Points enum type