C++
Define an interface class from which XYPoint and XYZPoint couldinherit so we could compare these points using a polymorphicfunction.
For XYPoint class: it includes the x and y coordinates as doublenumbers, defines constructors/destructor, getters, setters, anddistanceToOrigin() which computes the distance from the point tothe (0,0) coordinate. Method distance takes another XYPoint andcomputes the distance between that point and the currentinstance.
XYZPoint class: it includes function distance that returns thedistance (as a double) between two: XYPoints, an XYPoint and anXYZPoint (assume z = 0 in this case), and two XYZPoints. Thefunction can be called with any possible pairs of points. Do notduplicate code
OR
OR