Fat Pointer

This is a discussion on Fat Pointer within the C++ Programming forums, part of the General Programming Boards category; Code: int Output() { .. } class Layer1_c { int (*Output)() { .. } int Work() { .. Output(); } ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    48

    Fat Pointer

    Code:
    int Output()
    {
    	..
    }
    class Layer1_c
    {
    	int (*Output)()
    	{
    		..
    	}
    	int Work()
    	{
    		..
    		Output();
    	}
    };
    class Layer2_c
    {
    	int (*Output)()
    	{
    		..
    	}
    	int Work()
    	{
    		..
    		Output();
    	}
    };
    Layer1_c Layer1;
    Layer2_c Layer2;
    Layer1.Output = &Output;
    Layer2.Output = &Layer1.Work; // <--- ?
    How do i assign Layer2.Output to point to Layer1.Work?
    Last edited by like_no_other; 12-28-2009 at 02:13 PM. Reason: Misswritten Layer1.Output instead of Layer1.Work

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    How about posting something that "sort of" compiles? (Except perhaps only for the part that you are having trouble with.)
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    82
    I'm not sure right off the bat, but this might give you the insight to get it to work;
    Pointers to C++ Member Functions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 11:10 AM
  2. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 04:47 PM
  3. Parameter passing with pointer to pointer
    By notsure in forum C++ Programming
    Replies: 15
    Last Post: 08-12-2006, 08:12 AM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 04:36 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 01:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21