[原创]值类型——枚举
枚举继承System.Enum,它是值类型。
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
__value enum color
{
red=1,
blue=3,
green,
black=7,
gray
};
int _tmain()
{
color mycolor;
Console::Write(S"red is:");
Console::WriteLine(color::red);
Console::Write(S"green is:");
Console::WriteLine(color::green);
Console::Write(S"gray is:");
Console::WriteLine(color::gray);
mycolor=red;
Console::Write("mycolor is:");
Console::WriteLine(mycolor);
return 0;
}