Sign in to follow this  

Can someone interpret this line of code for me?

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

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