Function Pointer Problem--Please Assist 
Author Message
 Function Pointer Problem--Please Assist

I have been having problems trying to resolve passing a pointer function
in C++.

It appears that my program elicits errors based on
the following lines of code:

in a separate class's .c file:
        //rgb_t rgb = solid->tex().givrgb();  //Case 1
        //rgb_t rgb = solid->tex->givrgb();  //Case 2
        //rgb_t rgb = solid->tex(givrgb());  //Case 3
        rgb_t rgb = rgb_t(15,15,15);

Where:
        rgb_t is a type from class rgb,
        solid is of a class presolid.
        tex is def'd by:

   public:
        texture_t(*tex)();          

        and givrgb() is a public member function

        The only line that actually worked was the hard-coded (15,15,15) line.
        Case 1 compiled and linked, but resulted in a run-time "Illegal
        Instruction" error.  Cases 2 and 3 did not compile correctly.

        Any ideas?  Btw, I also tried ->(*tex)().givrgb(); but that
        did not compile either.  Am I calling this pointe function correctly?  

        Thanks in advance...

Perry ...



Thu, 02 Oct 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. C++ function pointers versus C function pointer problem

2. How to use (pointer to function), and function and pointer to (pointer to function)

3. Please Assist Student programming C

4. Experienced VC++ programmers, please assist VB guy lookin to learn C++

5. BitBlt in MFC - can someone assist please?

6. Experienced VC++ programmers, please assist VB guy lookin to learn C++

7. Starting a dialog minimized: please assist.

8. pointer to pointer problem, please advice

9. Pointer Functions and Pointers to Pointer Functions

10. Problem assigning function to function pointer

11. Pointer to struct function NEWBIE PLEASE HELP

12. Help with function pointer declaration please!

 

 
Powered by phpBB® Forum Software