Thread View: gnu.g++
1 messages
1 total messages
Started by Naoki Saito (GEO-002) Ext. 5471
Wed, 27 Sep 1989 14:36
Friend or public member?
Author: Naoki Saito (GEO-002) Ext. 5471
Date: Wed, 27 Sep 1989 14:36
Date: Wed, 27 Sep 1989 14:36
19 lines
1116 bytes
1116 bytes
Hello, folks! I sometimes wonder whether I should use friend function or public member to implement some function. Suppose I defined a vector class. If I want to retrieve the size or dimension of the declared vector, which one should I use? The following segments explains the situation: vector a(100); int naf = dim(a); // friend function version. int nap = a.dim(); // public member function version. This is only the matter of the implementor's taste? Should I implement both ways? If there's any reason to prefer one of them to the other, please let me know. Thanks in advance, Naoki Saito (saito@sdr.slb.com) Schlumberger-Doll Research
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