I really like the way you have used using to specify only the items you actually use rather than bringing the whole namespace into scope with the using namespace statement.
One thing, though. In your header files you should always qualify your symbols with the namespace rather than the using directive. That's good in the .cpp files and the main file, but should not appear in header files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#ifndef POINT_H
#define POINT_H
#include <iostream>
class Point
{
friend std::istream &operator>>( std::istream &, Point & );
friend std::ostream &operator<<( std::ostream &, const Point & );
private:
int xCoordinate;
int yCoordinate;
};
#endif
|
I'm not sure why you put setw(1) in your extraction operator? It seems to work fine without it..
The only requirement left to implement is not outputting if your object was not correctly read from the input stream.
I can only think you are going to need to record the state of the Point in the object itself so as to know if the input was valid or not.
To that effect you should probably be using something other than ignore() to skip the inputting of the '(', ')' and ',' characters. At the moment I can enter X4=7& as input and it works the same as (4,7).