Nis Posted December 4, 2004 Share Posted December 4, 2004 Salut INpact Je commence à faire du C++ mais j'ai un petit problème pour faire des classes ... Par exemple, je crée 3 fichier : main.cpp, Point.cpp et Point.h. En voici leur contenu : // main.cpp #include <iostream> using namespace std; #include "Point.h" int main() { Point a(1,2); system("pause"); return 0; } // Point.cpp #include "Point.h" class Point { private : int x; int y; public : Point (int abs, int org) { x = abs; y = ord; } }; // Point.h #ifndef POINT_H #define POINT_H Point (int, int); #endif Je voudrais créer l'objet a de type Point (Point a(1,2); ), mais ça ne fonctionne pas :( Merci d'avance pour votre aide Link to comment Share on other sites More sharing options...
Nis Posted December 4, 2004 Author Share Posted December 4, 2004 Hmm ... Ok je crois que j'ai compris. Comme ça, ça fonctionne : //main.cpp #include <iostream> using namespace std; #include "Point.h" int main () { Point a(1,2); system ("pause"); return 0; } //Point.cpp #include "Point.h" Point::Point (int abs, int ord) { x = abs; y =ord; } //Point.h #ifndef POINT_H #define POINT_H class Point { int x; int y; public: Point (int, int); }; #endif Link to comment Share on other sites More sharing options...
Fafhrdius Posted December 5, 2004 Share Posted December 5, 2004 tu as compris :-) Link to comment Share on other sites More sharing options...
theocrite Posted December 5, 2004 Share Posted December 5, 2004 Bien trouvé le titre Link to comment Share on other sites More sharing options...
Nis Posted December 6, 2004 Author Share Posted December 6, 2004 Bien trouvé le titre Mes jeux de mots à la c** ^^ Link to comment Share on other sites More sharing options...
raven Posted December 6, 2004 Share Posted December 6, 2004 Mes jeux de mots à la c** ^^ Heuuuu tu devais avoir bcp transpirer et abuser de l'Amaréto là car...Enfin no commant Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.