Jump to content
  • Advertisement
Sign in to follow this  
pghTech

Can someone interpret this line of code for me?

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

The following line of code is compilable (if thats a word). It is a constructor to a class. I am just lookin for someone to break down the "english" composion of it (...a function that takes an argument of X of type Y, another argument....ect). I posted my beliefs of what what it is, but I need someone to confirm or tell me what it is if I am wrong.
ResourceManager( void (*CreateResourceFunction)( Type **resource, char *name, char *path ) = NULL )
 {
		m_list = new LinkedList< Type >;

		CreateResource = CreateResourceFunction

My interpretation: Contructor named ResourceManager that takes the arguments: 1) A pointer to a function with a return type of void which it takes the arguments of 1a)?????? Type **resource 1b) a pointer named name of type char 1c) a pointer named path of type char

Share this post


Link to post
Share on other sites
Advertisement
I am guessing this is a template class/function and type is your typename? It looks exactly as you have specified, a constructor that takes a function pointer argument that has three arguments.

Share this post


Link to post
Share on other sites
Hi.

ResourceManager is a function (probably a class function or a constructor) that takes in a single parameter. That parameter is a function pointer for a function that takes in 3 parms. The '= NULL' means that the CreateResourceFunction parameter has a defaul value of NULL.

Steve

Share this post


Link to post
Share on other sites
Also that is more C style development so if you are using C++ (which you don't mention so I am just guessing) I would heavily suggest using Functors.

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!