Function Pointer passing

Hey guys, this is my first time posting on here and I just can't seem to get this program working the way I feel like it should. I have been working on this for a class project and was progressing pretty well and I got to a point where I have a problem my teacher can't seem to figure out. He thought it looked like it should work, but there is clearly a problem.

these are earlier files than they are currently, but can demonstrate the problem I am still getting.

http://pastebin.com/zJ0bnR1D
http://pastebin.com/QycQ7TmG
http://pastebin.com/P84BeMxP
http://pastebin.com/TABHMLaY

The Problem lies in the Jclass.h and StuffedToys.h files. I made an entire class just for the menu of the program and it takes a function pointer as an argument. This clearly works correctly in the main method, however it does not in things like the constructors for the S_Bear class. Anyone have ideas?
The second link doesn't work
1
2
3
4
void BuildABear()
{
        S_Bear NewBear(); //Create New Bear
}
Does the S_Bear constructor have a secondary effect? Because that function creates a new object that dies in the next line.

Maybe you want to use polymorphism
1
2
3
4
class S_Bear : public animal;
class Cart{
  std::vector<animal*> animals; //don't put using namespace std in headers
};

actually, I fixed those issues in a newer file already, It's really here that I need people's help:

http://pastebin.com/gCdwsLW7

sorry about the second link not working, this should fix that.
To use function pointers, you put a '&' before the function name, not a '*'. Also, the syntax for member function pointers is not the as the syntax for normal function pointers. See here for more info on that:

http://www.parashift.com/c++-faq-lite/pointers-to-members.html
Topic archived. No new replies allowed.