Staff  Downloads  Internet Banking

Why Insurance

The Point structure in Listing 7-5 declares a method called IsAtOrigin. The code in that
method checks the values of the structure methods, returning true if the coordinates of the
point are (0, 0) and false otherwise.
The Main() method declares two variables of type Point: the MyFirstPoint variable is set to
coordinates of (100, 200) using the explicit constructor, and the MySecondPoint variable is
set to coordinates of (0, 0) using the default parameterless constructor. The Main() method
then calls the IsAtOrigin method on both points and prints out a message based on the
method's return value.
If you compile and run the code in Listing 7-5, you see the following output on the console:
MyFirstPoint is not at the origin.
MySecondPoint is at the origin.