Article View: gnu.gcc.help
Article #49731Function pointer problem
From: Jason Austin
Date: Mon, 13 Dec 1993 16:05
Date: Mon, 13 Dec 1993 16:05
47 lines
1199 bytes
1199 bytes
Take this hunk of code:
#include <stdio.h>
class Test {
public:
Test();
~Test();
private:
int (*fp)();
int testfunction();
};
int Test::testfunction()
{
}
Test::Test()
{
fp=testfunction;
}
Test::~Test()
{
}
int testfunction()
{
}
main()
{
int (*fp)();
fp=testfunction;
}
Why does the assignment in main() compile but the one in
Test::Test() reports "assignment between incompatible pointer types".
I'm using g++ 2.5.6. Thanks.
--
Jason C. Austin
j.c.austin@larc.nasa.gov
Technical Details
Message-ID:
<JASON.93Dec13110517@ab02.larc.nasa.gov>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!uunet!news.larc.nasa.gov!news.larc.nasa.gov!jasonShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,7995d8ee432feb24,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-12-13 12:33:24 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!uunet!news.larc.nasa.gov!news.larc.nasa.gov!jason From: jason@ab02.larc.nasa.gov (Jason Austin) Newsgroups: gnu.gcc.help Subject: Function pointer problem Date: 13 Dec 1993 16:05:17 GMT Organization: NASA Langley Research Center, Hampton, VA Lines: 48 Message-ID: <JASON.93Dec13110517@ab02.larc.nasa.gov> Reply-To: Jason C. Austin <j.c.austin@larc.nasa.gov> NNTP-Posting-Host: ab02.larc.nasa.gov