inputting numbers within a class

I was wondering how to input an object's values for a Cartesian class. Would this involve overloading the input function, or would it be something else?
Really depends on what you want to do.

If you want to do something like this:
1
2
  Cartesian coord; 
  cin >> coord;


Then yes, that would involve overloading the >> operator.

There are other approaches, such as prompting the user for x and y, possibly editing the values, then calling a setter in the Cartesian class.
Would I put that segment of code in the main function then? and overload the >> operator within the Cartesian class?
Would I put that segment of code in the main function then?

That depends on where in your code you want to read in the coordinates, but yes, you can do that in main.

overload the >> operator within the Cartesian class?

Yes.
Topic archived. No new replies allowed.