Функція, яка приймає об'єкти
class Point
{
public:
int x;
int y;
};
void Add(Point obj1, Point obj2)
{
cout << "x=" << obj1.x + obj2.x << " y=" << obj1.y + obj2.y << endl;
}
int main()
{
Point p1, p2;
p1.x = 1;
p1.y = 1;
p2.x = 2;
p2.y = 3;
Add(p1, p2); // x=3 y=4
}