class Point
{
private:
int x, y;
public:
Point()
{
}
// Parameterized Constructor
Point(int x1)
{
x=x1;
}
Point(int x1, int y1)
{
x = x1;
y = y1;
}
int getX()
{
return x;
}
int getY()
{
return y;
}
};
int main()
{
Point p(10);
p = Point(50,100);
}
does Point(50,100) returns an object??Can Anyone explain the details about the execution in main function. for assigning p with Point(50,100) it should give an object.
Point, which in turn is assigned to thepusing implicitly-defined copy-assignment operator (memberwise copies all the data members,xandyin this case).