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

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


Geometrical::Tripple::Tripple(): x(0), y(0), z(0){
}

Geometrical::Tripple::Tripple(int xi, int yi, int zi): x(xi), y(yi), z(zi){
}

Geometrical::Tripple::Tripple(Point p): x(int(p.getx())), y(int(p.gety())), z(0){
}

int Geometrical::Tripple::getx() const {
    return x;
}

int Geometrical::Tripple::gety() const {
    return y;
}

int Geometrical::Tripple::getz() const {
    return z;
}

std::ostream& Geometrical::operator<<(std::ostream& s, const Geometrical::Tripple& tr){
  return s << "[" << tr.getx() << "," << tr.gety() << "," << tr.getz() << "]";
}