Exercise

Exposing your Parent

By default, R6 classes only have access to the functionality of their direct parent. To allow access across multiple generations, the intermediate classes need to define an active binding that exposes their parent. This takes the form

active = list(
  super_ = function() super
)

Instructions

100 XP

A microwave oven class has been predefined for you in your workspace.

  • Extend the fancy microwave oven class by adding an active list element.
  • Add an active binding to expose its parent's functionality.
    • The binding should be called super_.
    • It should be a function that takes no arguments and simply returns super.
  • Instantiate a fancy microwave object and assign it to a_fancy_microwave.
  • Call the fancy microwave's super_ binding.