problem in Constructor

May 3, 2015 at 6:52pm
Hi everyone,,,i write a class of Rational numbers. My constructor with default parameters shows errors,,why??

1
2
3
4
5
6
7
8
9
10
11
class Rational{

private: int a,b;
public:
	Rational(int =1,int =2);
};

Rational::Rational(int a1=1,int b1=2)
{
   a=a1;b=b1;
}


It says "redefinition of default parameter"
May 3, 2015 at 8:11pm
You can't specify default values on your implementation (line 8).
Topic archived. No new replies allowed.