Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!usc!sdd.hp.com!decwrl!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: Pointers to overloaded functions Message-ID: <424@taumet.com> Date: 28 Aug 90 15:08:28 GMT References: <1990Aug27.155621@Pkg.Mcc.COM> Organization: Taumetric Corporation, San Diego Lines: 30 steve@Pkg.Mcc.COM (Steve Madere) writes: >I need a way to get a pointer to one of a set of overloaded functions. >void print(char*); >void print(int); >void print(float); >printmythingy(v,print,ser1); >How do I specify that the print function that I want is the one that goes >with the char* argument? The prototype for printmythingy must show the type of each argument. Each function of an overloaded set must have a different type. Thus you can't help but specify that at most one of any overloaded function set may be used. Example: void printmythingy(T1, void(*)(char*), T2); For the second argument, you may pass only a function returning void and having just one parameter of type char*. There is only one of the print functions having that type, so writing printmythingy(v,print,ser1); can only result in passing void print(char*); as the print function. -- Steve Clamage, TauMetric Corp, steve@taumet.com