Question: private: double x , y , z ; l; class 3 DShape 1 public: 3 DShape ( const string& color ) : color ( color
private:
double ;
l;
class DShape
public:
DShape const string& color : colorcolor
virtual double getVolume const ;
protected:
string color;
;
i Terbitkan satu kelas Sphere daripada kelas DShape. Kelas DSphere perlu mempunyai satu objek center dengan jenis Point yang mewakili koordinat pusat sfera dan satu member data persendirian radius dengan jenis double.
Derive a class Sphere from the class DShape. The class Sphere should have an object center of type Point that represents the coordinate of the center of the sphere and a private data member radius of type double.
markah marks
ii Langkau fungsi getVolume di bawah kelas Sphere untuk mengira isipadu sfera tersebut.
Override the getVolume function under the class sphere to calculate the volume of the sphere.
markah marks
iii. Tuliskan satu fungsi main untuk menguji kelaskelas tersebut. Tetapkan warna sfera sebagai biru, jejari pusat sfera pada dan paparkan isipadu sfera tersebut.
Write a main function to test the classes. Set the color of the sphere as blue, radius center of the sphere at and display the volume of the sphere.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
