Skip to content

Instantly share code, notes, and snippets.

@derofim
Created August 14, 2015 07:32
Show Gist options
  • Select an option

  • Save derofim/d6a6b2f5851634bde0e7 to your computer and use it in GitHub Desktop.

Select an option

Save derofim/d6a6b2f5851634bde0e7 to your computer and use it in GitHub Desktop.
#include <iostream>
enum class Color { RED, GREEN, BLUE };
Color redColor = Color::RED; // RED -> Color::RED
int num = ( int ) Color::GREEN; // RED -> ( int ) Color::RED
int main()
{
if ( redColor == Color::GREEN ) { std::cout << "RED == GREEN"; } // false
if ( num == (int) Color::GREEN ) { std::cout << "x=1 == GREEN"; } // true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment