码迷,mamicode.com
首页 > 编程语言 > 详细

c++小记

时间:2016-04-25 14:52:24      阅读:154      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!