I'm learning about operator overloading and coded this. I have a getX() and getY() in my .h file. However it keep on prompting error as topic stated.. help on this pls
Since point2D::operator+ is a part of the Point2D class, you should be able to directly access 'x' and 'y':
temp.x = getX() + param.getX();
Cubbi's method is still a lot cleaner though. If you're going to assign values to a new Object, you're better off doing it in the constructor.
/tmp/ccACVakl.o: In function `Line3D::Line3D()':
main.cpp:(.text+0x59a): undefined reference to `vtable for Line3D'
/tmp/ccACVakl.o: In function `Line3D::Line3D(Point3D, Point3D)':
main.cpp:(.text+0x62a): undefined reference to `vtable for Line3D'
main.cpp:(.text+0x693): undefined reference to `Line3D::setLength()'
collect2: ld returned 1 exit status