Article View: es.comp.lenguajes.c++
Article #123Como pasar un puntero a función miembro como parametro de otra función
From: jrbcast
Date: Tue, 07 Oct 2008 10:11
Date: Tue, 07 Oct 2008 10:11
23 lines
1668 bytes
1668 bytes
Hola,
Tengo el siguiente problema:
class A
{
double ejemplo(double *p)
{
return do_job(p+1);
}
}
Ahora resulta que otra función de externa a esta clase toma como
parámetro un
puntero a una función, más concretamente:
void foo( double(*f)(double* x) )
Me gustaría pasar el método "ejemplo" como argumento a la función foo.
¿Cómo lo puedo hacer?.
Gracias de antemano.
Technical Details
Message-ID:
<4a22be7f-4b21-495b-91da-271ee842ded1@k7g2000hsd.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!k7g2000hsd.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f53ec,7827fb6d5a442b8e,start X-Google-Attributes: gidf53ec,domainid0,public,usenet X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!k7g2000hsd.googlegroups.com!not-for-mail From: jrbcast@gmail.com Newsgroups: es.comp.lenguajes.c++ Subject: Como pasar un puntero a función miembro como parametro de otra función Date: Tue, 7 Oct 2008 03:11:14 -0700 (PDT) Organization: http://groups.google.com Lines: 23 Message-ID: <4a22be7f-4b21-495b-91da-271ee842ded1@k7g2000hsd.googlegroups.com> NNTP-Posting-Host: 150.244.87.118 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1223374275 3081 127.0.0.1 (7 Oct 2008 10:11:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 7 Oct 2008 10:11:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k7g2000hsd.googlegroups.com; posting-host=150.244.87.118; posting-account=h2lfHQoAAACqfsN9yL0nKhXPX_fnJMkm User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; es-ES; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3,gzip(gfe),gzip(gfe)