C++ Effective_02

来源:互联网 发布:dcn oracle python 编辑:程序博客网 时间:2024/06/06 07:40
#define ASPECT_RATIO 1.653 
const double AspectRation = 1.653; 
const char* const authorName = "Scott Meyers"; 
const std::string authorName("Scott Meyers"); 


class GamePlayer
{
private:
  static const int NumTurns = 5; 
  int scores[NumTurns];  
}
const int GamePlayer::NumTurns;


class CostEstimate{
private:
  static const double FudgeFactor; 

const double CostEstimate::FudgeFactor = 1.35; 


class GamePlayer{
private: 
  enum { NumTurns = 5}; 
  int scores[NumTurns]; 
}


#define CALL_WITH_MAX(a, b) f((a) > (b) ? (a) : (b))


int a = 5, b = 0; 
CALL_WITH_MAX(++a, b); 
CALL_WITH_MAX(++a, b+10); 


template<typename T>
inline void callWithMax(const T& a, const T& b)
{
  f(a > b ? a : b); 
}


 
0 0