Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions