Ist das alter Stil??
-
Hallo hab n Skript von 2003.
Übe jetzt c++ und habe folgendes geschrieben.
Der Compiler sagt irgendwie dass das in Zeile 5 alter Stil ist.
Nutze MS visual c++.class colormap{ colormap(double min,double max,int typ); }; colormap::colormap(double min,double max,int typ); { minimum = min; maximum = max; typus = typ; }Fehlermeldung für Zeile 5:
colormap.cpp(5):error C2447: '{': Funktionskopf fehlt - Parameterliste im alten Stil?
Außerdem
Fehlermeldung für Zeile 4:
colormap.cpp(4): error C2761: '__ctor': Die erneute Deklaration der Memberfunktion ist unzulässigWas ist mit einer Memberfunktion gemeint???

Danke euch!!!!!
-
colormap::colormap(double min,double max,int typ); { ... }Da gehört kein Semikolon ans Ende der erste Zeile.
-
[...]
Da war einer schneller.
-
Super danke euch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

-
Hi,
außerdem ist es eher "neuer Stil", eine Initialisierungsliste zu nutzen:
colormap::colormap(double min,double max,int typ) : minimum(min), maximum(max), typus(typ) {}Hat diverse Vorteile ... kannst ja mal nach "Initialisierungsliste" googlen/suchen.
Gruß,
Simon2.
-
Ich denke, dass der Compiler aufgrund des Semikolons eine K&R Funktionsdeklaration vermutet hat und deswegen diese Meldung ausgegeben hat.