Based
on the following program answer the question
#include
using namespace std;
class Point {
private:
int x, y;
public:
Point(int x1,int y1)
{
x=x1;y=y1;
}
void operator+(Point &pt3);
void show() {cout << "x
= " << x << ", y = " << y; } };
void Point::operator+(Point
&pt3)
{
x += pt3.x;
y += pt3.y;
}
int main()
{
Point pt1(3,2),pt2(5,4);
pt1+pt2;
pt1.show();
return 0;
Which
of the following operator is overloaded?
Based
on the following program answer the question
#include<iostream>
using namespace std;
class Point {
private:
int x, y;
public:
Point(int x1,int y1)
{
x=x1;y=y1;
}
void operator+(Point &pt3);
void show() {cout << "x
= " << x << ", y = " << y; } };
void Point::operator+(Point
&pt3)
{
x += pt3.x;
y += pt3.y;
}
int main()
{
Point pt1(3,2),pt2(5,4);
pt1+pt2;
pt1.show();
return 0;
}
Based
on the following program answer the question
#include<iostream>
using namespace std;
class Point {
private:
int x, y;
public:
Point(int x1,int y1)
{
x=x1;y=y1;
}
void operator+(Point &pt3);
void show() {cout << "x
= " << x << ", y = " << y; } };
void Point::operator+(Point
&pt3)
{
x += pt3.x;
y += pt3.y;
}
int main()
{
Point pt1(3,2),pt2(5,4);
pt1+pt2;
pt1.show();
return 0;
}