Hey guys, so I just started learning computational geometry, and I decided to make a class for a Point and a class for a Ray. This is my code:
#include <iostream>
#include <string>
using namespace std;
class Point {
public:
double x, y;
Point(double x, double y) {
this->x = x;
this->y = y;
}
};
class Ray {
public:
Point start, end;
Ray(Point start, Point end) {
this->start = start;
this->end = end;
}
};
int main() {
cout << "If only this worked..." << endl;
}
Now, when I comment out the Ray class, the Point class works fine. However, when I make the Ray class, it wont compile. This is what I get:
"C:\Users\Matt\Desktop\C++\geom.cpp||In constructor 'Ray::Ray(Point, Point)':|
C:\Users\Matt\Desktop\C++\geom.cpp|20|error: no matching function for call to 'Point::Point()'|
C:\Users\Matt\Desktop\C++\geom.cpp|10|note: candidates are: Point::Point(double, double)|
C:\Users\Matt\Desktop\C++\geom.cpp|6|note: Point::Point(const Point&)|
C:\Users\Matt\Desktop\C++\geom.cpp|20|error: no matching function for call to 'Point::Point()'|
C:\Users\Matt\Desktop\C++\geom.cpp|10|note: candidates are: Point::Point(double, double)|
C:\Users\Matt\Desktop\C++\geom.cpp|6|note: Point::Point(const Point&)|
||=== Build finished: 6 errors, 0 warnings ===|
"
Can anybody help me get something that at least compiles and be so kind to explain what I did wrong? Thanks!