constant static public attributes
Bruno Schneider
bruno_schneider@hotmail.com
Mon Sep 27 19:59:00 GMT 2004
Hi, I'm having problems creating constant static public attributes which
depend on other objects of the same kind. The situation is:
-- color.h ---
class color {
[...]
static const color WHITE;
}
------
#include "color.h"
-- color.cpp ---
const color color::WHITE(255,255,255);
[...]
------
color.o is generated by "g++ -o color.o -c color.cpp"
-- light.h ---
#include "color.h"
class light {
[...]
static const light SUN;
}
------
-- light.cpp ---
#include "light.h"
const light light::SUN(..., color::WHITE); // the color of SUN is WHITE
[...]
------
light.o is generated by "g++ -o light.o -c light.cpp"
The application is generated by "g++ color.o light.o main.o -o application",
but inside the application, the color of the SUN is not WHITE.
Is guess this is because code is generated such that the SUN is initialized
before WHITE is initialized...
Suggestions? Advice?
--
Bruno de Oliveira Schneider
bruno_schneider@hotmail.com
_________________________________________________________________
MSN Messenger: instale grátis e converse com seus amigos.
http://messenger.msn.com.br
More information about the Gcc-help
mailing list