Created
March 16, 2016 14:13
-
-
Save hamada-lemois/012d4b8f2296e54f15ce to your computer and use it in GitHub Desktop.
static const string members of struct in class
This file contains hidden or 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
| #include <iostream> | |
| class Character { | |
| public: | |
| struct Direction { | |
| static const std::string Front; | |
| static const std::string Back; | |
| static const std::string Left; | |
| static const std::string Right; | |
| }; | |
| }; | |
| const std::string Character::Direction::Front = "front"; | |
| const std::string Character::Direction::Back = "back"; | |
| const std::string Character::Direction::Left = "left"; | |
| const std::string Character::Direction::Right = "right"; | |
| int main() { | |
| std::cout << Character::Direction::Front << std::endl; | |
| std::cout << Character::Direction::Back << std::endl; | |
| std::cout << Character::Direction::Left << std::endl; | |
| std::cout << Character::Direction::Right << std::endl; | |
| return 0; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clang++ -std=c++11 hoge.cppでコンパイル