Good day, I've realized hierarchy of classes: Point -> LineSegment.
It's necessary to realize the following methods of the class: moving, stretching, rotating, turning, change on an axis. I'm trying to realize moving at a some distance on this code . What should I correct for in my code that it works?
#include <iostream.h>
#include <stdlib.h>
#include <cmath>
#include <conio.h>
// Classes
class Point
{
private:
// Members
double x;
double y;
public:
// Constructor
Point (double _x, double _y) : x(_x), y(_y) {}
};
class LineSegment
{
private:
// Members
Point p1;
Point p2;
public:
// Constructor
LineSegment (Point &_p1, Point &_p2) // Create a line from 2 points;
: p1(_p1), p2(_p2)
{ }
bool (LineSegment &ls) {
int dist;
ls.p1 = ls.p1 + dist;
ls.p2 = ls.p2 + dist;
}
return true;
};
int main()
{
Point A(1, 4), B(2, 3);
LineSegment t1(A,B);
cout << "Class hierarchy: Point -> Segment";
return 0;
}
[C++ Error] ClassMethods.cpp(32): E2293 ) expected