Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          program-organization/kn-clarification-with-namespace/point.cpp - The header file point.cpp.Lecture 3 - slide 27 : 27
Program 3

#include <cmath>
#include <iostream>
#include "point.h"

Geometrical::Point::Point(): x(0.0), y(7.0){
}

Geometrical::Point::Point(double x_coord): x(x_coord), y(20.0){
}

Geometrical::Point::Point(double x_coord, double y_coord): x(x_coord), y(y_coord){
}

Geometrical::Point::Point(Point& p): x(p.x + 1.0), y(p.y + 2.0){
}

Geometrical::Point::Point(Geometrical::Tripple t): x(double(t.getx())), y(double(t.gety())) {
}

double Geometrical::Point::getx () const{
    return x;
}
double Geometrical::Point::gety () const{
    return y;
}

std::ostream& Geometrical::operator<<(std::ostream& s, const Geometrical::Point& p){
    return s << "(" << p.x << "," << p.y << ")" ;
}