🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50632

Pointer to class members...

#50632
From: Nuno Miguel Santos Silva [lugo]
Date: Fri, 10 Sep 1993 14:16
47 lines
1642 bytes
Is there something I sould know about gcc 2.4.5 or is there really a
sintax error here:


#include <stdio.h>


class Class {

  public:
    int x, y;

  public:
    Class(void) { x = 36; y = -98; }
    ~Class(void) { }};


void Function(int Class::*p) {  <<<<<<<<---------

  Class anObject;

  printf("%d\n", anObject.*p); }


int main(int, char *[]) {

  int Class::*p = &Class::x;

  Function(p); Function(&Class::y);
  return 0; }


whe I run gcc -o myproblem myproblem.cc gcc yields this message:

myproblem.cc:14: parse error before `)'

Please, I would appreciate if you direct your replies to my e-mail
address, nss@fct.unl.pt, for I do not usually read this group.


Thanks, in advance.

--
Nuno Santos Silva                 | BITNET/Internet: nss@fct.unl.pt
Universidade Nova de Lisboa       |
FCT - Dpto. de Informatica        | Fax:   (+351) (1) 295-5641
2825 Monte Caparica, PORTUGAL     | Phone: (+351) (1) 295-4464
Technical Details
Message-ID: <1993Sep10.141627.18862@fct.unl.pt>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!cs.utexas.edu!uunet!pipex!uknet!mcsun!news.inesc.pt!dec4pt.puug.pt!unl!nss

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,651eff39db1f90fe,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-09-10 12:57:10 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!cs.utexas.edu!uunet!pipex!uknet!mcsun!news.inesc.pt!dec4pt.puug.pt!unl!nss
From: nss@fct.unl.pt (Nuno Miguel Santos Silva [lugo])
Subject: Pointer to class members...
Message-ID: <1993Sep10.141627.18862@fct.unl.pt>
Sender: news@fct.unl.pt (USENET News System)
Organization: Universidade Nova de Lisboa, PORTUGAL
X-Newsreader: TIN [version 1.2 PL0]
Date: Fri, 10 Sep 1993 14:16:27 GMT
Lines: 47