関数の引数や戻り値の値の意図を記述できる。
- 値は明示しないと0から順に付けられる
- サイズは環境依存であるため、通信プロトコルでの利用などでは注意すること
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// enum.cpp | |
// CplusplusPractice | |
// | |
// Created by masai on 2015/05/23. | |
// Copyright (c) 2015年 masai. All rights reserved. | |
// | |
#include <iostream> | |
using namespace std; | |
enum Gender{ | |
MALE, | |
FEMALE | |
}; | |
enum FunctionType{ | |
NORMAL = 1, | |
ACTIVATION = 2, | |
LOSS = 3 | |
}; | |
enum Type{ | |
YES = 1, | |
NO = -1 | |
}; | |
class A{ | |
public: | |
Type function(){ | |
return NO; | |
} | |
}; | |
int main(int argc, char* argv[]){ | |
A a; | |
cout << a.function() << endl; | |
} |
0 件のコメント:
コメントを投稿