Bonjour à tous,

Je test en c++ le tutoriel mis sur le site.

Sous visual c++ 2008 voilà le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
 
using namespace std ;
 
class Point  
{  
     int x;  
     int y;  
public :  
     Point();  
     Point(int, int);  
     ~Point();  
     void Init(int a, int b);  
     void Init(int a=0);  
     void Deplace(int a, int b);  
     void Deplace(int a=0);  
     void Affiche(char* strMesg=""); 
     int Coincide(Point &); 
};  
Point::Point()  
{  
     cout << "--Constructeur par defaut--" << endl;  
}  
Point::Point(int a, int b)  
{  
     cout << "--Constructeur (a,b)--" << endl;  
     Init(a,b);  
}  
Point::~Point()  
{  
     cout << "--Destructeur--" << endl;  
}  
void Point::Init(int a, int b)  
{  
     x = a;  
     y = b;  
}  
void Point::Init(int a)  
{  
     Init(a,a);  
}  
void Point::Deplace(int a, int b)  
{  
     x += a;  
     y += b;  
}  
void Point::Deplace(int a)  
{  
     Deplace(a,a);  
}  
void Point::Affiche(char *strMesg)  
{     // On ne rajoute pas le paramètre par   
      // défaut dans l’implémentation !  
     cout << strMesg << x << ", " << y << endl;  
} 
int Point::Coincide(Point & p)  
{  
     if( (p.x==x) && (p.y==y) )  
       return 1;  
     else  
       return 0;  
}  
 
 
 
void main()  
{  
     Point p(1,2);  
     p.Deplace(4);  
     p.Affiche("Le point vaut "); 
     p.Init(10);  
     p.Affiche("Le point vaut desormais : ");  
     Point pp;  
     pp = p;  
     p.Deplace(12,13);  
     pp.Deplace(5);  
     p.Affiche("Le point p vaut ");  
     pp.Affiche("Le point pp vaut ");
     Point ppp(2,0);
     Point pppp(2);
     if( ppp.Coincide(pppp) )  
          cout << "p et pp coincident !" << endl;  
     if( pppp.Coincide(ppp) )  
          cout << "pp et p coincident !" << endl;
Le compilateur donne l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
1>------ Début de la génération*: Projet*: Essai tutorial 1, Configuration*: Debug Win32 ------
1>Compilation en cours...
1>Test_points.cpp
1>c:\travail\travail_bac_a_sable\vsual c\essai tutorial 1\essai tutorial 1\test_points.cpp(80) : error C2664: 'Point::Point(const Point &)'*: impossible de convertir le paramètre 1 de 'int' en 'const Point &'
1>        Raison*: impossible de convertir de 'int' en 'const Point'
1>        Aucun constructeur n'a pu prendre le type de source, ou la résolution de la surcharge du constructeur était ambiguë
1>Le journal de génération a été enregistré à l'emplacement "file://c:\TRAVAIL\Travail_bac_a_sable\Vsual C\Essai tutorial 1\Essai tutorial 1\Debug\BuildLog.htm"
1>Essai tutorial 1 - 1 erreur(s), 0 avertissement(s)
========== Génération*: 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========
Si quelqu'un peit m'expliquer le problème

Merci beaucoup.

P.G