C++ Programming:

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

C++ Programming:

Post by answerhappygod »

C++ Programming:
C Programming 1
C Programming 1 (47.36 KiB) Viewed 44 times
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;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply