Advertisement
tinyevil

Untitled

Jul 27th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. struct Color{
  2.     int red;
  3.     int green;
  4.     int blue;
  5.    
  6.     Color(int hex)
  7.         : ...{
  8.     }
  9.    
  10.     Color(const std::string& s)
  11.         : ... {
  12.     }
  13.    
  14.     Color(int r, int g, int b)
  15.         : ... {
  16.     }
  17.    
  18.     //good default Color anyone?
  19.     // Color()  {}
  20. };
  21.  
  22. void foo(){
  23.     Color color;
  24.    
  25.     if ( config.has("color") ){
  26.         color = Color(config.get("color"));
  27.     }else{
  28.         color = Color(theme.get_default_color());
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement