As the code got too long, we split it up into different .rb files, one for each class. When doing so we touched the topics of passing functionality to a class either through delegation or inheritance. For delegation there are three options:
def_delegators :@lamp, :height, :width
Steffi who did the coaching (thanks so much!) , also informed us that there are many wise sayings out there, as for example "Composition over inheritance". Can't wait to make a calendar ;)
- initialize in attribute accessor
- write an extra method
- use the module Forwardable, e.g.:
def_delegators :@lamp, :height, :width
Steffi who did the coaching (thanks so much!) , also informed us that there are many wise sayings out there, as for example "Composition over inheritance". Can't wait to make a calendar ;)