Jump to content
  • Advertisement
Sign in to follow this  
bobbinus

Pointers question

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

Hello I have a function(belonging to ClassA). The functions purpose is to intialise a pointer to a ClassB. There are a few pointers belonging to ClassA that are of this type and all shall be initialised using this function. The function takes an enumeration and then uses a switch statement to intialise some function variables with the appropriate constants...the enumeration also indicates which member pointer should be initialised. So, I want to use a local function pointer to classB and create the new object and then set the appropriate memeber pointer to that object. To do all this I can use two switch statements: one at the start for the variables....and one at the end to set the member pointer to the local one. Can I just use one switch statement...at the start? At first I thought so but now maybe not. I thought make a pointer to pointer and use that to select the member pointer in the first swictch statement then indirectly initialise it...but it causes a memory crash...the following is representative of what I tried to do...3rd line causes a crash.... float** ppf = NULL; float* pf = NULL; *ppf = pf; *ppf = new float;

Share this post


Link to post
Share on other sites
Advertisement
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!