Thread: passing templates as parameters - something funky?

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    1

    passing templates as parameters - something funky?

    I've got a linked list template that's similar to this:

    template<class T>
    class List{
    private:

    struct Node{
    T data;
    Node* next;
    Node* previous;
    };

    public: // List interface goes here
    };

    I'm getting an error when passing a specific list type as a parameter instead of just the generic linkedlist, which worked previously.

    This is the error I'm receiving, which doesn't make much sense to me. By my understanding, I'm passing the list to the function with the right pointer format:


    asn2.cpp: In function `int main()':
    asn2.cpp:424: no matching function for call to `display_mainmenu (LinkedList<Person> *&)'


    Here's my function definition:
    void display_mainmenu(LinkedList<Person> *dir);

    And here's the code that's giving the problem:
    int main(){

    LinkedList<Person> *directory;
    display_mainmenu(directory);

    return 0;
    }

    I'm getting frustrated... once I get this working smoothly, the rest of the project will be a breeze.
    Any pointers would be appreciated

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    559
    Not sure if this is the problem, but you call your template List when you declare it, LinkedList in main.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newb Question on Passing Objects as Parameters
    By Mariano L Gappa in forum C++ Programming
    Replies: 12
    Last Post: 11-29-2006, 01:08 PM
  2. Replies: 7
    Last Post: 04-19-2006, 11:17 AM
  3. Passing parameters to modal dialogs
    By Halloko in forum Windows Programming
    Replies: 2
    Last Post: 10-11-2005, 07:15 AM
  4. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 03:13 AM
  5. Passing Parameters
    By fry in forum C++ Programming
    Replies: 2
    Last Post: 10-04-2002, 03:06 AM