On Sun, 2002-02-03 at 22:44, Gregor S. wrote:
> Hi Danny,
^^^
D>e<nny darauf bestehe ich :-)
> class employee {
> public:
> char name[64];
> long employee_id = 0;
> float salary = 0;
> ...
> };
als Ergebnis erhalte ich:
c++ -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -fno-exceptions
-fno-check-new -c main.cpp
main.cpp:28: ANSI C++ forbids initialization of member `employee_id'
main.cpp:28: making `employee_id' static
main.cpp:28: ANSI C++ forbids in-class initialization of non-const
static member `employee_id'
main.cpp:29: ANSI C++ forbids initialization of member `salary'
main.cpp:29: making `salary' static
main.cpp:29: ANSI C++ forbids in-class initialization of non-const
static member `salary'
make[3]: Leaving directory `/home/denny/cpp/test/test'
make[3]: *** [main.o] Error 1
ich h�tte es mir auch nicht so recht vorstellen gekonnt. Ich vermute du
hast darauf angespielt, das die Variablen mit einer xy Zahl
initialisiert worden ist, sodass ich mit der '0' einen definierten
Zustand habe (denke ich :-) ..) Aber er bekommt ja sp�ter wenn der
Classe erstellt wird (worker;boss) Variablen zugewiesen. Demzufolge
h�tte mein test prog jedesmal ein anderes Ergebnis, aber es bleibt
konstant das selbe. :-/
> das k�nnte Abhilfe schaffen. Ansonsten, lies mal ein Kapitel weiter in
> deinem Buch, da wird erkl�rt was Konstruktoren sind. Probiers mal damit ;-)
da kommt Deklaration von Klassen-Methoden Au�erhalb der Klasse
cu denny
----------------------------------------------------------------------------
PUG - Penguin User Group Wiesbaden - http://www.pug.org