JC> JC> int mode() {
JC> JC> return mode_;
JC> JC> }
JC> TM> Better declare this method const.
JC> Twouldn't hurt, but then again, I'm not sure I've ever seen a const
JC> stream, so I doubt it makes any real difference. If you did somehow
JC> have a const stream, about ALL you'd be able to do with it would be
JC> its mode, and perhaps flags and such. You obviously wouldn't be abl
JC> read/write it, and a stream you can't read or write seems awfully cl
JC> to useless at first glance.
If the stream is a member of a constant object (of of an object whose
const method is called), you are only allowed to call the const
methods of the stream.
But that's only an example. Declaring all methods const that don't
modify the state of the object on which thy are applied is always
worth the effort in the long run. What do you lose declaring them
const? Nothing.
Thomas
---
þ MM 1.0 #0113 þ Nothing is so smiple that it can't get screwed up.
--- PCBoard (R) v15.22/M 25
---------------
* Origin: McMeier & Son BBS (2:301/138)
|