Jump to content
  • Advertisement
Sign in to follow this  
Kaze

C++ objetct pointer array

This topic is 4910 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

i want to create a pointer for a dyanamicly sizeable array of class pointer to be initalized into objects, a pointer to a array of pointers but Class *thing; thing=new *Class[3];//dosent like this line thing[0]=new Class(4); thing[1]=new Class(5); cout<< thing[0]->method<<endl;

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by mike25025
thing=new Class[3];

I want to create a array of pointer to objects not a array of object, this is so if i need to sort or resize the array i can just move the pointers without having to touch the data in the objects

Share this post


Link to post
Share on other sites
ah, thanks that worked

hmmm.......
thing = new Class*[3];
and
thing = new *Class[3];
is the diffrenc between working and 102 syntax errors

Share this post


Link to post
Share on other sites
Quote:
Original post by Kaze
...
is the diffrenc between working and 102 syntax errors


I know how you feel! I once did something like that in Dev-CPP and was prompted with this error code:

Quote:

[General Error] Too many messages; abort.
There must be something terribly wrong with your code. Please fix it.


It really made me laugh [lol].

- Drew

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!