1. Learn
  2. /
  3. Courses
  4. /
  5. Object-Oriented Programming with S3 and R6 in R

Connected

Exercise

Making a Fancy Microwave Oven

Inheritance means that the methods of the child class are exact copies of those in the parent class.

Instructions

100 XP

A microwave oven and and fancy microwave oven have been predefined in your workspace.

  • Instantiate a regular microwave oven and a fancy microwave oven, assigning the values to a_microwave_oven and a_fancy_microwave respectively.
  • Get the power_rating_watts value for each type of microwave, assigning the values to microwave_power_rating and fancy_microwave_power_rating respectively.
  • Use identical() (docs) to verify that the two power ratings are the same.
  • Call the cook() method of each type of microwave for one second and observe that you get the same behavior in each case.