const overload
so
so at so.so
Fri Sep 23 13:57:10 PDT 2011
On Fri, 23 Sep 2011 23:44:52 +0300, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> steves at steve-laptop:~/testd$ cat testconst.cpp
> #include <iostream>
> using namespace std;
>
> struct S {
>
> S& fun() {
> cout << "fun" << endl;
> return *this;
> }
>
> S fun() const {
> cout << "fun const" << endl;
> return S();
> }
> };
>
> int main() {
>
> S a;
> a.fun() = a.fun();
> return 0;
> }
> steves at steve-laptop:~/testd$ g++ -o testconst testconst.cpp
> steves at steve-laptop:~/testd$ ./testconst
> fun
> fun
> steves at steve-laptop:~/testd$
>
>
> Seems, um to be the same, no?
>
> -Steve
You are right, i am confused. Sorry about that.
More information about the Digitalmars-d-learn
mailing list