Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Jx

std::vectors and abstract interfaces

This topic is 5981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so I have an IRenderable interface. I want to make a vector of theses IRenderables. Now before we go off on one saying "hey - you can't instantiate an interface!!" i know that. But what i want to do is this: derive loads of "effects" from IRenderable and then put them into a vector, then loop through the vector and draw the effects stored within. so i need to store the interface in the vector if you see what i mean... and if i do this: std::vector< *IRenderable > RenderList; i get an error... any ideas? cheers Jx Edited by - Jx on February 8, 2002 9:09:13 AM

Share this post


Link to post
Share on other sites
Advertisement
I think if you make it

  
std::vector<IRenderable*> RenderList;


and make sure you have a forward declaration to the IRenderable type

Share this post


Link to post
Share on other sites
Hehehe - it works!

Thanks SteveC!

Oh well, we all make stupid mistakes sometimes...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!