/*
 * Copyright ©2026 Soham Pardeshi. All rights reserved.
 * Permission is hereby granted to students registered for University of
 * Washington CSE 333 for use solely during Summer Quarter 2026 for
 * purposes of the course. No other use, copying, distribution, or
 * modification is permitted without prior written consent. Copyrights
 * for third-party components of this work must be honored. Instructors
 * interested in reusing these course materials should contact the author.
 */

#include "Point.h"

#include <iostream>   // for std::cout, std::endl
#include <cstdlib>    // for EXIT_SUCCESS

using std::cout;
using std::endl;

// A const object (or a const& parameter) may call only const methods.
void PrintPoint(const Point& p) {
  cout << "(" << p.GetX() << ", " << p.GetY() << ")" << endl;
  // p.SetLocation(0, 0);  // ERROR: SetLocation is non-const
}

int main(int argc, char** argv) {
  Point p1(1, 2);  // each object gets its own copy of the data members
  Point p2(4, 6);

  PrintPoint(p1);
  PrintPoint(p2);
  cout << "dist = " << p1.Distance(p2) << endl;
  return EXIT_SUCCESS;
}

// Compile with:
//   g++ -Wall -g -std=c++17 -c Point.cc
//   g++ -Wall -g -std=c++17 -c usepoint.cc
//   g++ -Wall -g -std=c++17 -o usepoint usepoint.o Point.o