Silly c++ problem

Started by
10 comments, last by kzar 18 years, 2 months ago
Yea I have a standard map of sprites so that they aren't loaded twice. This code is for my animation loading function though. I just read from my file the sprite_count, I wanted to "malloc" myself an array of the sprite and then in a loop load each sprite from the file. Problem is because its c++ I couldn't make an array of the sprite class in advance because it didn't have an empty constructor so I thought I could just make an array of pointers and then allocate each one in the loop. I suppose it is a backwards way of doing it but I need an array of the sprites ready for when I create the animation object. Hmm
Advertisement
Actually I noticed a problem. I thought if I made that array of pointers to a class and then created an object on each of the pointers in the array it would same as having an array of objects but I think its different? ooer

This topic is closed to new replies.

Advertisement