Thread View: gnu.g++
1 messages
1 total messages
Started by Per Mildner
Wed, 31 May 1989 17:47
overloading operator->
Author: Per Mildner
Date: Wed, 31 May 1989 17:47
Date: Wed, 31 May 1989 17:47
34 lines
1216 bytes
1216 bytes
I wan't an object to be treated as a pointer by operator->. Below is an outline
of what i'm trying to do. I've tried several variants in the places marked '??'
but they don't seem to work. I understand that operator-> has some new meaning
attached to it recently but haven't seen it explained. The messages produced by
g++ (1.35.0 & 1.35.1-) give little indication as to what goes on, eg. 'inline
declaration ignored for function taking (...)' or some such.
class Object {
public:
int a;
};
class Pointer {
int data;
public:
Object* p;
?? operator ->();
};
inline ?? operator ->() {
return ?? p;
};
int main (int argc, char* argv[]) {
Object O;
Pointer P;
P.p = &O;
P->a = 10;
return P->a;
};
// I'm Per-Mildner@AIDA.CSD.UU.SE
// I wonder if I sen't this to the rigth place.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads