CommencerCommencer gratuitement

Making Microwave Ovens

To make an object, you create a factory, then call its new() method. Note that you don't need to define this method; all factories have a new() method by default.

a_thing <- thing_factory$new()

Cet exercice fait partie du cours

Object-Oriented Programming with S3 and R6 in R

Afficher le cours

Instructions

The microwave_oven_factory variable from the last exercise is in your workspace.

  • View the microwave_oven_factory.
  • Create a new MicrowaveOven object and assign it to the variable microwave_oven.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# View the microwave_oven_factory
microwave_oven_factory

# Make a new microwave oven
microwave_oven <- ___
Modifier et exécuter le code