Chapter 3 - Inheritance
Exercise 2: Cupcakes
We have a Confection
class representing baked desserts below. Your job is to create a new subclass of Confection
, named Cupcake
. Cupcakes need to be baked just like other confections, but they also need to be frosted afterward.
Write a prepare
method for your Cupcake
class that prints "Baking at 350 degrees for 25 minutes."
, and then prints "Applying frosting."
Do this without duplicating the puts
line from the prepare
method of the Confection
class.