Reference for one of overloaded functions

How do we do reference for one of overloaded functions by & operator?

1
2
3
4
5
6
  void f() { cout<<"as usual is "<<"\n";}


int main() {
  void (*p)() = &f;
 }

solved as:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// ...

  void f() { cout<<"1st OF"<<"\n";}

  void f(int n) { cout<<"2nd OF"<<"\n";}

  void f(char u, int n) { cout<<"3rd OF"<<"\n";}
  //... so on

int main() {
 
  void (*p)() = f;    // simple f not need else
  
  void (*r)(int) = f;   

  void (*s)(char, int) = f;

}
Last edited on
What do you mean? Show code as well and what you're trying to do.
Topic archived. No new replies allowed.