首页 > 编程语言 > 详细

c++小记

时间:2016-04-25 14:50:25      阅读:120      评论:0      收藏:0      [点我收藏+]

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

c++小记

原文:http://www.cnblogs.com/anywell/p/5430698.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!