Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started