Again I come crawling for help...

I made a program that makes coordiant points and lines with these coordinates. A new class is going to inherit from the class with the lines, and calculate the distance between a line segment and a point. I found the correct mathematical formula. With that I first calculate the distance between two points to get the length of the line segment. And this is where the problem is:

```
#include <iostream>
#include <math.h>
using namespace std;
class Calculating: public Line
{
private:
double distX;
double distY;
public:
Arvingen() {}
double distance()
{
distX = (x - x); // How do I make this x2-x1?
distY = (y - y); // How do I make this y2-y1?
dist2D = sqrt((distX*distX) + (distY*distY));
return dist2D;
}
}; // end class
```

The constructor in Line:

```
Line()
{
srand(time(0));
for(int i = 0;i <= 4;i ++)
{
x = rand() % 10 + 1;
y = rand() % 10 + 1;
linje2D[i].set2D(x, y);
bpunkt[i].set2D(x, y);
}
}
```

I've tried to get the distX and distY correct by using a for-loop and various other things like that, but all I get is a "expression must have pointer-to-object type".

Help....?