Visual studio Vs. X-code ..error

Hello guys, I have this program that I recently created on MS visual studio that adds fractions. It works great in visual studio, but when I run it in x-code I get errors on all of my operator overloading functions. I have included a function where i'm overloading the "*" symbol in my implementation file, which is where the error occurs. The error states "No matching constructor for initialization of 'fraction::rational". I was wondering if anyone has had experience with this problem and could point me in the right direction. I'm trying my best to learn how to use both compilers successfully. Thanks for any input :)

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
  // my header
namespace fraction
{
	class rational
	{
	private:
		int *numerator, *denominator;
        
	public:
		//constructors
		rational();
		rational(int, int);
		rational(int);
		rational(rational &);
		// get/set functions
		int get_numerator() const;
		int get_denominator() const;
		void set_numerator(const int);
		void set_denominator(const int);
		// operator overloading functions
		rational operator + (const rational &);
		rational operator - (const rational &);
		rational operator * (const rational&);
		rational operator / (const rational &);
		bool operator == (const rational &);
		bool operator < (const rational &);
		bool operator > (const rational &);
		bool operator <= (const rational &);
		bool operator >= (const rational &);
		friend ostream& operator << (ostream& os, rational fraction);
		friend istream& operator >> (istream& is, rational& fraction);
		// helper/validation functions
		void reduce()const;
		static bool validate(string s);
		static int gcd(int, int);
		static int lcm(const int, const int);
		static int validate_menu();
	};
}
 // example problem code
using namespace fraction;
rational rational::operator * (const rational &second_fraction)
{
	int top = this->get_numerator()*second_fraction.get_numerator();
	int bottom = second_fraction.get_denominator()*this->get_denominator();
	return rational(top, bottom);
}
Make the copy constructor const-correct.
1
2
// rational(rational &);
rational( const rational& ) ;
yep yep, that'll do it. Thank you Very much
Topic archived. No new replies allowed.