Function pointer question

This is a discussion on Function pointer question within the C++ Programming forums, part of the General Programming Boards category; When are function pointers used? And how would I go about making an array of function pointers, each pointing to ...

  1. #1
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262

    Function pointer question

    When are function pointers used?
    And how would I go about making an array of function pointers, each pointing to a different function with different return types and different parameters?
    I AM WINNER!!!1!111oneoneomne

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078

    Re: Function pointer question

    Originally posted by Panopticon
    When are function pointers used?
    Manually doing dynamic binding with a vtable (and other places, but this is probably the most common).

    Originally posted by Panopticon
    And how would I go about making an array of function pointers, each pointing to a different function with different return types and different parameters?
    You can't make an array of function pointers with different return types or arguments. You can make an array of function pointers with the same argument types and return types though:

    Returntype (*ArrayName[NumberOrElements])(Arguments);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  2. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  3. Function pointer question
    By sbayeta in forum C Programming
    Replies: 9
    Last Post: 08-06-2004, 09:15 AM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 02:27 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 10:51 AM

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