Question: Problem Statement Create a class called Bird. Add one private member variables weight. Add getter and setter function for the weight. The get function returns
Problem Statement
Create a class called Bird. Add one private member variables weight. Add getter and setter function for the weight. The get function returns the weight of the bird. The set function assign the value to the weight of the bird. Implement a constructor that expects weight value and assigns it to the member variable.
Create a subclass of Bird named Duck. The Duck class has one private member variable color. Add a constructor which expects color and weight Pass weight to the base constructor and set weight to it's member variable. Note: Please don't add a space to your answer.
Partial Solution
#include
using namespace std;
:
double weight;
public:
Bird
cout "Bird
;
Birddouble newWeight
this weight ;
getWeight
this weight;
setWeightdouble newWeight
thisweight ;
derived class
: public
:
;
public:
string newColor, double newWeight :
thiscolor ;
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
