From: Frank V. C. <fr...@co...> - 2000-10-31 03:39:11
|
What is the hierarchy? You may need dynamic_cast<> based on the rules of usage in 1998(E) C++ standard. What is the error, and what is the compiler/platform? John Palmieri wrote: > > I am trying to integrate SOMELib into snaglepuss and am having errors > with downcasting my objects. > > You see I have a hiarchy of interfaces for use with dynamicly loadable > assets (png, mp3, mpg files). They all get loaded and stuffed into > chests which are just glorified vectors of type mriIAsset *. Now each > of the assets can be rendered to the screen, audio device, etc. with a > call to the render() method. But, each type of asset also has enhanced > functionality based on their type so my png loader asset would also > inherit the interface mriIVisualAsset which would in turn inherit the > mriIAsset interface. The problem I am having is that when I load my > object I check to see if it is visual, audio. Let's say it is a visual > asset. I then use this code to construct the object: > > SOME::Object<mriIVisualAsset>oAsset(assets[0]); > //construct our asset > if(!oAsset.construct()){ ... > > this works fine but now I want to add this asset to my chest: > > asset = static_cast<mriIAsset *>(oAsset); //error here. I'm guessting > the template is not truly inheriting > > chest->addAsset( chestpos, asset );//I should be able to mix and match > different assests in my chest > > This is an important feature and as much as I know you love the boost > stuff if it restricts projects from using standard C++ mechanisms when > working with SOMELib it will have to go. > > -Quinticent > > _______________________________________________ > somelib-devel mailing list > som...@li... > http://lists.sourceforge.net/mailman/listinfo/somelib-devel -- Frank V. Castellucci http://corelinux.sourceforge.net OOA/OOD/C++ Standards and Guidelines for Linux http://PythPat.sourceforge.net Pythons Pattern Package |