use of constructor problem

Error:shi::shi(int)' and `shi::shi(int)' cannot be overloaded, dont exactly know what that means....help please!

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
  #include <iostream>
using namespace std;

class shi{
public:
int age;
shi(int x)

{
age = x;
};
shi (int y)
{
age = y;
};

friend int add(shi so,shi sw);


};
int add(shi so,shi sw)

{
return so.age + sw.age;
};

int main()
{int c;
shi s1(46);
shi s2(51);
c = add(s1.age,s2.age);

cout<<c;
}
this constructor
1
2
3
4
5
shi(int x)

{
age = x;
};


and this constructor are the same
1
2
3
4
shi (int y)
{
age = y;
};

you can only have one
thanks!
Topic archived. No new replies allowed.