C++ Programming:
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\n"; } Bird(double newWeight){ this //derived class public: getWeight() { this setWeight(double newWeight){ :public (string newColor, double newWeight): this->weight= weight= this->color= weight;
C++ Programming:
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am