Thread: Problem with a function pointer syntax

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #14
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Although, the OP said it should only work with foo, which in that case, why are we bothering with pointers to functions?Code:

    Code:
    static int X::bar(X object) {    object.foo();}

    Well, this is true. That is a whole lot simpler and ensures that only foo will be called of instances of X.
    Oh...Can't imagine I couldn't think of that...!!
    It'd solve my current problem in a very elegant way...
    I had two objects...and a static function for connecting them..
    Code:
    connect(X a,X b) {b.func2(a.func1());}
    //would be the skeletal structure of it..apart from exception handling/..
    Last edited by manasij7479; 07-02-2011 at 07:43 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-01-2010, 01:05 PM
  2. Function syntax to return a pointer...
    By tzuch in forum C Programming
    Replies: 1
    Last Post: 05-29-2008, 07:53 AM
  3. HELP!! Function Definition problem? Syntax Error I think..
    By felixgun in forum C++ Programming
    Replies: 12
    Last Post: 11-04-2006, 04:49 AM
  4. struct pointer to function syntax
    By kermit in forum C Programming
    Replies: 2
    Last Post: 03-21-2004, 04:01 PM
  5. syntax to pass a member function pointer to another class?
    By reanimated in forum C++ Programming
    Replies: 4
    Last Post: 11-27-2003, 05:24 PM