Sign in to follow this  

C++ objetct pointer array

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

This topic is 4694 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this