Bonjour
Le programme fonctionne sans constructeur mais pourquoi lorsque j'en indique un (constructeur point) il positionne l'erreur suivante ligne 30

invalid fonction 'int main()'
no matching function for call 'point::point()'
note candidates are point::point (const point&)
point::point (int int)

.......... Merci ............

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
#include <iostream>
#include <stdlib.h>
using namespace std;
class point
{ 
  public:     
       int x;
       int y;
      point (int,int);
       void initialise (int, int);
       void deplace (int, int);
       void affiche ();
};
void point :: initialise (int abs, int ord)
 {      x = abs ; y = ord;
}
point::point (int i, int j)
{ x = i +10;
  y = j + 10;
}
void point :: deplace (int dx, int dy)
{
     x  +=dx;
     y  += dy;
}
void point :: affiche ()
{    cout << "Je suis en  "  << x << " " << y << "\n";
}
main ()
{   point a, b, c; //ligne 30
 
    a.point (8, 9);
     a.initialise (5, 2); a.affiche ();
    a.deplace (-2, 4); a.affiche ();
   /* b.initialise (1, -1) ; b.affiche ();
   c.initialise (60, 2); c.affiche ();
     c.deplace (-2, 4); c.affiche ();
     c.initialise (1, -1) ; c.affiche ();
     a.initialise (5, 2); a.affiche ();*/
     system("PAUSE");
     }