Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Unliterate

returning a pointer in a member of my class?

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

in my particle engine im trying to get ::Delete() to return a pointer to a particle struct thats "*previous"ly linked from the paramater which is also a pointer. i have
class ParticleSystem
{
public: yada;
private:
     struct particle{
     yada;
     particle *next;
     particle *previous;
     };
     particle* Delete(particle *exile);
};

//---------------------------------------------------


particle* ParticleSystem::Delete(particle *exile)
{
     yada;
     return exile->previous;
}
now in my main.cpp using a diferent linked list i can return the pointer like that with no problem. (its not in a class). what am i doing wrong? it gives my "missing ;" errors and says " error C2501: 'Delete' : missing storage-class or type specifiers" and "error C2556: 'int *__thiscall ParticleSystem::Delete(struct ParticleSystem:article *)' : overloaded function differs only by return type from 'struct ParticleSystem:article *__thiscall " the source up there is split between a .h and a .cpp [edited by - unliterate on April 20, 2004 7:30:10 PM] [edited by - unliterate on April 20, 2004 7:31:59 PM] [edited by - unliterate on April 20, 2004 7:32:47 PM] [edited by - unliterate on April 20, 2004 7:33:56 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try

ParticleSystem::particle* ParticleSystem::Delete(particle *exile)

instead.

Edit: ok, code tags cause
Edit2: typo, it's too late for me here

[edited by - VolkerG on April 20, 2004 7:36:23 PM]

[edited by - VolkerG on April 20, 2004 7:37:30 PM]

Share this post


Link to post
Share on other sites
Well everythgin worked perfectly when Delete was void, the only thing ive added to get 7 errors is change the return type ( to speed up the system).

Share this post


Link to post
Share on other sites
putting "ParticleSystem::" works , thanks! (my particle engine is the first class ive ever made so im learning as i go )

[edited by - unliterate on April 20, 2004 7:38:57 PM]

Share this post


Link to post
Share on other sites

  • 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!