#include <iostream>
#include <cmath>
using namespace std;

class Point {
protected:
	double x, y;
	
public:
	Point() : x(0), y(0) {}
	
	Point(double x, double y) : x(x), y(y) {}
	
	double getx() {
		return x;
	}
	
	double gety() {
		return y;
	}
	
	double dist(const Point& p) {
		return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
	}
};

class Point3D : public Point {
private:
	double z;
	
public:
	Point3D() : Point(), z(0) {}
	
	Point3D(double x, double y, double z) : Point(x, y), z(z) {}
	
	double getz() {
		return z;
	}
	
	double dist(const Point3D& p) {
		return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y) + (z - p.z) * (z - p.z));
	}
};

int main() {
	Point3D A;
	Point3D B(4, 5.6, 7.8);
	
	double distance = A.dist(B);
	cout << "|A-B|=" << distance << endl;
	
	return 0;
}