M
Marcin Vorbrodt
So I have a class Math that looks like this:
Math {
public:
static Real PI(void);
};
Real Math:I(void) {
return 4.0 * atan(1.0);
}
The problem is, that this is a class with only static methods. All the class
has are just some methods that return certain constants, it also has statics
for trig functions. A friend pointed out, that it might not be such a great
design. On the other hand, i dont want to use this:
static const Real PI = 4.0 * atan(1.0);
Because i dont know the order in which statics are initialized, and some
other static could later depend on the value of PI;
Any ideas? Is there a more graceful solution to the problem of global static
values in C++.
Martin
Math {
public:
static Real PI(void);
};
Real Math:I(void) {
return 4.0 * atan(1.0);
}
The problem is, that this is a class with only static methods. All the class
has are just some methods that return certain constants, it also has statics
for trig functions. A friend pointed out, that it might not be such a great
design. On the other hand, i dont want to use this:
static const Real PI = 4.0 * atan(1.0);
Because i dont know the order in which statics are initialized, and some
other static could later depend on the value of PI;
Any ideas? Is there a more graceful solution to the problem of global static
values in C++.
Martin