Challenge: Visitor Pattern
Explore how to implement the Visitor design pattern to filter Rock music from a music library in JavaScript. Learn to create classes for Song, RockMusicVisitor, and MusicLibrary that work together to produce a Rock playlist by using object-oriented programming principles within behavioral design patterns.
We'll cover the following...
We'll cover the following...
Problem statement
In this challenge, you need to implement the visitor pattern to separate Rock music from the other genres of music by creating a separate playlist. You need to implement the RockMusicVisitor class for this purpose. As you can see, it contains the visit method, which should return the rock music playlist.
Note: the rock music playlist only needs ...