I am creating a pair1 class for a x and y Cartesian coordinate system. x and y are doubles. I need to have 3 constructors.
- No arguments, defaults x and y to zero.
- One arguement assigns x and defaults y to zero.
- One arugeument defaults x to zero and assigns y. I'm not sure if I am setting up the class right. I get the follwing error:
pair1::pair1(double)
andpair1::pair1(double)
cannot be overloaded.
My class:
class pair1
{
private:
double x;
double y;
public:
pair1(){ x = 0.0, y = 0.0; }
pair1( double a ){ x = a; y =0.0; }
pair1(double b){ x = 0.0; y = b; }
};