i working on program similar netflix , involves movies.
i have movie object/class api program uses. made inherited class of object so.
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using tmdblib.objects.movies; namespace movie_management.data { class mymovie: tmdblib.objects.movies.movie { public string path { get; set; } } }
here code movie object api use.
tmdblib.objects.movies.movie movie = new tmdblib.objects.movies.movie(); movie = movieprocesses.loadtmdblib(justmoviename); mymovie mymovie = (mymovie)movie; mymovie.path = path; cacher cache = new cacher(); cache.cachevideo(mymovie);
i attempt cast tmdblib movie mymovie object. not work. supposed in situation?
{"unable cast object of type 'tmdblib.objects.movies.movie' type 'movie_management.data.mymovie'."}
you can't cast "backwards" in inheritance hierarchies. can go movie mymovie, not other way around.
if want add stuff existing movie object, add constructor mymovie takes movie object parameter , copy member variables across manually.
Comments
Post a Comment