Is this the proper way to use a static const variable? In my top level class (Shape)
#ifndef SHAPE_H
#define SHAPE_H
class Shape
{
public:
static cons
If you have a way to add C++0x
flag to your compiler, you would've been able to do:
ifndef SHAPE_H
#define SHAPE_H
class Shape
{
public:
static constexpr double pi = 3.14159265;
private:
double originX;
double originY;
};
#endif
In C++0x
you are able to use const expressions to types other than integral ones. This enables you to declare and define in place your constant variable.