User Tools

Site Tools


gsoc2016_keyboard_classes_overview

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
gsoc2016_keyboard_classes_overview [2016/05/16 14:48]
ferranpujolcamins [ControllerPresetVisitor]
gsoc2016_keyboard_classes_overview [2016/05/16 16:22] (current)
ferranpujolcamins [ControllerPresetVisitor]
Line 18: Line 18:
 Suppose //preset// is a //​MidiControllerPreset//​. First Suppose //preset// is a //​MidiControllerPreset//​. First
 //​Controller::​setPreset(const Controller&​ preset)// calls the //​preset.accept(ControllerVisitor* visitor)//, which calls //​visitor.visit(this)//​. But since //preset// is of type //​MidiControllerPreset//,​ the method that is called is //​Controller::​visit(MidiControllerPreset* preset)//, thus controller now knows the type of //preset//. //​Controller::​setPreset(const Controller&​ preset)// calls the //​preset.accept(ControllerVisitor* visitor)//, which calls //​visitor.visit(this)//​. But since //preset// is of type //​MidiControllerPreset//,​ the method that is called is //​Controller::​visit(MidiControllerPreset* preset)//, thus controller now knows the type of //preset//.
 +
 +Providing a fallback //​Controller::​visit(ControllerPreset* preset)// ​ saves us from implementing a //visit// method for each subclass of //​ControllerPreset//​.
  
  
gsoc2016_keyboard_classes_overview.txt ยท Last modified: 2016/05/16 16:22 by ferranpujolcamins