When I try to create more than one object, I get an error saying no matching function for call. I don't understand, usually I can create as many objects as I want without a hitch but the moment I add a parameterized constructor in the equation, suddenly I'm not allowed to create more than one object. Why is it so?
Here's the code:
#include <iostream>
using namespace std;
class Point
{
private:
int x, y;
public:
Point(int x1, int y1)
{
x = x1;
y = y1;
}
int getx()
{
return x;
}
int gety()
{
return y;
}
};
int main()
{
Point c2, c3;
Point c = Point(10, 20);
cout << c.getx() << " " << c2.gety() << " " << c3.getx() << endl;
return 0;
}