home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!news.mentorg.com!sdl!adk
- From: adk@Warren.MENTORG.COM (Ajay Kamdar)
- Subject: Re: pointer to member function.
- Message-ID: <1992Sep7.180658.8239@Warren.MENTORG.COM>
- Organization: Mentor Graphics Corp. - IC Group
- References: <1992Sep5.015422.2429@unixland.natick.ma.us>
- Date: Mon, 7 Sep 1992 18:06:58 GMT
- Lines: 34
-
- In article <1992Sep5.015422.2429@unixland.natick.ma.us> dlb@unixland.natick.ma.us (David L. Briggs) writes:
- > A simple question. If you have a class that has several functions
- >with the same name that are overloaded, how can you take the address of one
- >of these function?
-
- class A {
- public:
- int foo(int);
- int foo(char *);
-
- int bar(int);
- int bar(char *);
- };
-
- main()
- {
- int (A::*p1)(int);
- int (A::*p2)(char *);
-
- p1 = &A::foo; // points to int A::foo(int)
- p2 = &A::foo; // points to int A::foo(char *)
-
- p1 = &A::bar; // points to int A::bar(int)
- p2 = &A::bar; // points to int A::bar(char *)
- }
-
-
- - Ajay
-
- --
- I speak for none but myself.
-
- Ajay Kamdar Email : ajay_kamdar@mentorg.com
- Mentor Graphics, IC Group (Warren, NJ) Phone : (908) 580-0102
-