#include "Vertex.hpp"
#include <cmath>
#include <iostream>

Vertex::Vertex(){
  (*this).x = 0;
  this -> y = 0;
  std::cout << "default constructor aufgerufen" << std::endl;
}

Vertex::Vertex(double x,double y){
  (*this).x = x;
  this -> y = y;
}

Vertex::Vertex(double x){
  (*this).x = x;
  this -> y = x;
}

double Vertex::betrag(){
  return sqrt(x*x + this->y * this->y);
}

UnterVertex::UnterVertex(double x,double y,double z):Vertex(x,y){
  this -> z = z;
}

double UnterVertex::betrag(){
  return sqrt(x*x + this->y * this->y+z*z);
}

int main(){
  Vertex* v1 = new Vertex(17,4);
  Vertex v2 = 42;
  UnterVertex* v3 = new UnterVertex(14,1,477); 
  v1 = v3;
  std::cout <<  v3 -> betrag() << std::endl;
  std::cout <<  v1 -> betrag() << std::endl;
  return 0;
}
