Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » |SOLVED] Vector of object: cast to inherited class
Re: Vector of object: cast to inherited class [message #52365 is a reply to message #52363] Sat, 14 September 2019 21:45 Go to previous messageGo to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Xemuth wrote on Sat, 14 September 2019 07:41

It mean I must use an Array<A*> ? Their is no way to do something like the exemple bellow without having to work with ptr ?

Array<A> is similar to Vector<A*>.
The only difference is that it (Array<A>) owns data. This means that Array<A> in its destructor will call delete on each pointer it stores, so, you cannot store pointers to objects on stack in an Array.


Regards,
Novo
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: copying code from web into IDE
Next Topic: Simple way to develope 2D Game
Goto Forum:
  


Current Time: Mon Apr 29 03:57:31 CEST 2024

Total time taken to generate the page: 0.03050 seconds