🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #234

how to do this?

#234
From: John Edstrom
Date: Thu, 10 Sep 1992 20:33
30 lines
1019 bytes

I am trying to convert some C++ code to g++.  What is wrong with the
following constructions and how can I do it in g++?

----------

class a {
public: 
	int x();
};

int a::x() { return 1; }

main() {
	printf("%x\n", (int(*))a::x);
}


the compiler complains that it cannot convert a::x to a pointer


what am I doing wrong?

JE
--
 RM 2104, HSc Building,  Div. Neuroscience
 U. Calgary School of Medicine,  3330 Hospital Drive NW
 Calgary, Alberta       T2N 3Y4
 (403) 220 4493  (wk)
Technical Details
Message-ID: <92Sep10.203359.4881@acs.ucalgary.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!van-bc!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!acs.ucalgary.ca!news

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help
Path: arc1-ca.pugleaf.net!sparky!uunet!van-bc!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!acs.ucalgary.ca!news
From: edstrom@Elmer.hsc.ucalgary.ca (John Edstrom)
Subject: how to do this?
Message-ID: <92Sep10.203359.4881@acs.ucalgary.ca>
Sender: news@acs.ucalgary.ca (USENET News System)
Date: Thu, 10 Sep 92 20:33:59 GMT
Distribution: gnu
Nntp-Posting-Host: elmer.hsc.ucalgary.ca
Organization: Neuroscience Division, U of Calgary School of Medicine, Calgary, Alberta, Canada
Lines: 30