IMO, Movie
and Music
objects are completely different and should not be derived from a common base class. But, if you still want to do it, modify the Item
class as shown below (Just an example code. please do not use this code as-is)
abstract class Item
{
virtual object GetData(string sDataID);
}
Now, in the derived classes you can override this method something like below.
class Movie: Item
{
private Producer m_Producer = new Producer();
override object GetData(string sDataID)
{
object ret = null;
switch(sDataID)
{
case "Producer":
ret = m_Producer;
break;
}
}
And, in the client code you can do something like below.
Item objItem = new Movie();
Producer objProducer = (Producer)objItem.GetData("Producer");
You get the idea!