U++ framework
Do not panic. Ask here before giving up.

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: 1432
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: Wed Jun 17 19:51:46 GMT+2 2026

Total time taken to generate the page: 0.00670 seconds