Who's the Daddy?
a_microwave_oven
is an object created by microwave_oven_factory
. a_fancy_microwave
is an object created by fancy_microwave_oven_factory
. You can explore these objects in your workspace.
Which of the following statements are true?
- A microwave oven is a fancy microwave oven. That is,
inherits(a_microwave_oven, "FancyMicrowaveOven")
returnsTRUE
. - A fancy oven microwave is a microwave oven. That is,
inherits(a_fancy_microwave, "MicrowaveOven")
returnsTRUE
. - Both types of microwave oven are R6 objects. That is,
inherits(a_microwave_oven, "R6")
andinherits(a_fancy_microwave, "R6")
both returnTRUE
. - Only regular microwave ovens are R6 objects. That is,
inherits(a_microwave_oven, "R6")
returnsTRUE
butinherits(a_fancy_microwave, "R6")
returnsFALSE
. - Neither types of microwave oven are R6 objects. That is,
inherits(a_microwave_oven, "R6")
andinherits(a_fancy_microwave, "R6")
both returnFALSE
.
This exercise is part of the course
Object-Oriented Programming with S3 and R6 in R
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
