Question: class XYZ{ protected: //data members double x; double y; double z; public: //constructors XYZ (); XYZ (double a[] ); void set XYZ (double x0, double

class XYZ{ protected: //data members double x; double y; double z; public: //constructors XYZ (); XYZ (double a[] ); void set XYZ (double x0, double y0, double z0); XYZ get XYZ() const; double get X() const; double get Y() const; douvle get Z() const; void print() const; };

XYZ::XYZ() { x = y = z = 0; } XYZ::XYZ( double a[] ) { x = a[0]; y = a[1]; z = a[2]; }

a)

implement the function getxyz() which returns an xyz object consisting of the values of the data members x, y , z. (Note that you are not allowed to add any new member functions or constructors to the class)

b)

Implement a derived class named Triple which inherits everything from XYZ and has an operator > which compares two Triple objects a and b, returning true if a > b and false otherwise. Note that a > b if and only if each data member of a is larger than the corresponding one of b. show the implementations of the constructors and the operator > of Triple.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!