Question: Create a class named CupCake. It contains: Has private instance variables egg butter baking powder sugar flour milk All members must have public methods: getter()
Create a class named CupCake. It contains: Has private instance variables egg butter baking powder sugar flour milk All members must have public methods: getter() and setter(). A constructor a default constructor with no arguments. The constructor will initial all member variable to a default value 0. One public pure virtual function showIngredients() that returns void. The function will show ingredient lists to the screen. Create the two classes ChocolateCupCake and WatermelonCupCake that both publicly inherit from CupCake. A class called ChocolateCupCake contains one private instance variable for chocolate amount with an appropriate data type, one overloaded constructor that sets a value for the chocolate amount. And one override showIngredients function shows all ingredient lists and the chocolate amount A class called WatermelonCupCake contains one private instance variable for watermelon amount with an appropriate data type, one overloaded constructor that sets a value for the watermelon amount. And one override showIngredients function shows all ingredient lists and the watermelon amount All member variables for each class must have getter and setter functions. Both classes must override the showIngredients () function of the base class. Use appropriate access modifiers in each class to enforce information hiding (public/private). Finally, test all classes by creating objects and all functions in the main function.
write in C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
