1
Reply

Still having trouble with Delegates, need help with my example

schmintan

schmintan

Oct 20 2010 12:23 PM
7k

Im writing a basic example of delegates usage to help explain it to me. Here is my idea.
User (object) has a playlist of songObjects.
Each songObject contains a song title and the media the song is on (MP3 or CD).
There is a MediaPlayer(object) that has two other Objects, a CDPlayer(object) and mp3Player(object)
The user inputs the songObjects list into a media player, calls the play method, and for each song the user expects back a string that lists the song name and the device it was played on.
when calling the play method, the user does not care if the song is played on a cd player or the mp3 Player, only that the song is played and they get a string back stating this, and the device it was played on.
I have some source code but its all over the place as im having trouble implementing this. Is this a valid example?

Answers (1)