const and immutable

Tim Verweij tjverweij at gmail.com
Tue Jul 6 09:10:04 PDT 2010


Not sure if I'm double posting now. Sorry if I am, but I didn't see my own post
appear this time.

Anyway, thanks for your replies, that was very helpful. I had one more question
about inout. If I understand correctly it cannot be used to get rid of the double
GetBar function in the following C++ example:

class Foo
{
public:
  const Bar& GetBar() { return mBar; } const
        Bar& GetBar() { return mBar; }
private:
  Bar mBar;
};

Is that correct? Or is there a way to make this one function in D?


More information about the Digitalmars-d-learn mailing list