Jump to content
  • Advertisement

Archived

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

InsaneX

Function Overloading

This topic is 5323 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 was wondering if there was an easier way to overload a function to accept different types of data (int, float), when the type wouldn''t matter. An example of this would be a memory manager, you have a DeAllocate() function, no matter what type of pointer is passed, you want to just delete it, and it won''t matter what type. (this is assuming no arrays)

Share this post


Link to post
Share on other sites
Advertisement
Thank you very much Desert Fox!! I knew I had read about something like this somewhere, and I was looking through my unorganized tutorials and I couldn''t find it.

Share this post


Link to post
Share on other sites
And possibly another good solution would be using a void *, which accepts any datatype (and furthermore you could cast them to an int, float, etc)


void DeAllocate(void *ptr)
{
delete ptr;
}


[edited by - _twiggie_ on January 24, 2004 7:48:26 AM]

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!