On Thu, Aug 27, 2009 at 4:50 PM, thefirstrepairdad<[email protected]> wrote:

> But if I try to initialize a list, and return the appropriate data type, 
> thusly:
>
> extern struct DATA *initialize_list(void);
> extern struct ENTRY *initialize_list(void);
>
> and call it with
>
> struct  DATA   *Dlist = initialize_list();
>
> or
>
> struct  ENTRY  *Elist = initialize_list();
>
> I get errors saying:
> "new declaration 'ENTRY* initialize_list()'"
> "ambiguates old declaration 'DATA* initialize_list()'"
>
> I assume because this function has no arguments, it can't determine which 
> version to use? Is there a way to do this? Do I need to pass an unused 
> argument to "set" the data type and just ignore it? As:
>
> extern struct DATA *initialize_list(const DATA *llist);
> extern struct ENTRY *initialize_list(const ENTRY *llist);

Personally I'd take this a step further and use classes for this kind
of thing, so you don't have to deal with function overloading like
this... you're already using C++, so why not? It will make your life a
lot easier, believe me.

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to