Programming question of the week ;)

Martin Naef EMAIL HIDDEN
Tue Apr 14 22:32:31 CEST 2009


Mikael Hansson wrote:
> int main()
> {
>    Cd *cd1 = new Cd("Music-barr", "Shelter");
> 
>    vector<Item*> vec;
>    vec.push_back(cd1);
> 
>    vec[0]->setArtist("Music-bar");
> }

I'm with Marc on that one. Generally, do the setArtist thing while you 
know what type you're dealing with. You can either do that by keeping 
separate lists for each subtype, or by having your editing functionality 
through a type-aware editing system.

Martin

-- 
http://www.navisto.ch
http://www.myspace.com/navisto



More information about the music-bar mailing list