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

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


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

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

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

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

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

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

std::ostream& operator<<(std::ostream& s, const Tripple& tr){
  return s << "[" << tr.x << "," << tr.y << "," << tr.z << "]";
}