Article View: comp.windows.interviews
Article #326Simple Member Function Question
From: John Lu
Date: Wed, 15 Apr 1992 06:02
Date: Wed, 15 Apr 1992 06:02
21 lines
881 bytes
881 bytes
I saw following in IV's code.
class Bar { /* ... */ };
class Foo {
public:
const Bar& func() const { return bar_; }
Bar& func() { return bar_; }
private:
Bar bar_;
};
It seems to me that only the 2nd member function is enough. What's
rationale for having two member functions ? (guess that I still to work
harder on my C++)
Thanks,
--
-- John Lu
luj@ecn.purdue.edu
Technical Details
Message-ID:
<1992Apr15.060238.29092@noose.ecn.purdue.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!news.cs.indiana.edu!noose.ecn.purdue.edu!sanandreas.ecn.purdue.edu!lujShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.interviews Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!news.cs.indiana.edu!noose.ecn.purdue.edu!sanandreas.ecn.purdue.edu!luj From: luj@sanandreas.ecn.purdue.edu (John Lu) Subject: Simple Member Function Question Message-ID: <1992Apr15.060238.29092@noose.ecn.purdue.edu> Sender: news@noose.ecn.purdue.edu (USENET news) Organization: Purdue University Engineering Computing Network Distribution: usa Date: Wed, 15 Apr 1992 06:02:38 GMT Lines: 21