Session Ready
Exercise

Over-Overriding the Cooking Capabilities

Once intermediate classes have exposed their parent functionality with super_ active bindings, you can access methods across several generations of R6 class. The syntax is

parent_method <- super$method()
grand_parent_method <- super$super_$method()
great_grand_parent_method <- super$super_$super_$method()
Instructions
100 XP

Microwave oven and fancy microwave oven classes have been predefined for you in your workspace. A string ascii_pizza_slice has also been predefined.

  • Explore the other microwave oven factories by printing their names.
  • Define a HighEndMicrowaveOven class generator using R6Class(), and assign it to high_end_microwave_oven_factory.
    • It should inherit from FancyMicrowaveOven.
    • It should have a public list element.
  • Override the public cook() method.
    • The method should take a single argument named time_seconds.
    • It should call the MicrowaveOven's cook() method, ...
    • then display a pizza slice using message(ascii_pizza_slice).
  • Instantiate a high-end microwave oven object and assign it to a_high_end_microwave.
  • Call a_high_end_microwave's cook() method to cook for one second.