ex4-12p.h - Example 4-12 Point and Line classes - Point Header file (ex4-12p.h)

// File: ex4-12p.h – Point class header file
	
#ifndef POINT_H
#define POINT_H

inline double square(double d) { return d*d; }

class Line;		// forward declaration

class Point
{
private:
    double x;
    double y;
public:

    // Constructors

    // Create Point at origin
    Point(void);

    // Create Point using x-y coordinates
    Point(double x1, double y1);

    // Create Point as midpoint of two Points
    Point(const Point& p, const Point& q);

    // Create Point as intersection of two lines
    Point(const Line& l, const Line &m);

    // Copy constructor
    Point(const Point& p);

    // print a point as (x,y)
    void print(void) const;

    // accessor functions
    double get_x(void) const;
    double get_y(void) const;

    // assign value to x member
    void set_x(double x1);

    // assign value to y member
    void set_y(double y1);

    // determine the distance to another point
    double distance_to_Point(const Point& p) const;
};

#endif



CIS27: Programming in C++    Instructor: Joe Bentley