Question: Complete the class dog so that the code in main works as described in the comments. The necessary constructor declarations are already provided for you.
Complete the class dog so that the code in main works as described in the comments. The necessary constructor declarations are already provided for you. You may define the constructor and method bodies inside or outside the class, as you choose. Use explainations as well.
class dog { private: // all data members must be private public: // public constructor declarations dog(); dog(string breed, int weight); dog(int weight); // public method declarations go here }; int main() { dog bonny; dog wimpy; dog fido("rottweiler", 200); dog snuffles(15); bonny.setBreed("pit bull"); bonny.setWeight(500); wimpy.setWeight(-300); bonny.speak(); //I'm a 500 lbs pit bull wimpy.speak(); //I'm a 0 lbs mutt fido.speak(); //I'm a 200 lbs rottweiler snuffles.speak(); //I'm a 15 lbs mutt bonny.switchBodies(fido); bonny.speak(); //I'm a 200 lbs rottweiler fido.speak(); //I'm a 500 lbs pit bull dog puppy; puppy = fido.mateWith(wimpy); puppy.speak(); //I'm a 250 lbs pit bull-mutt return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
