Transitive const sucks

Gregor Richards Richards at codu.org
Wed Sep 12 07:18:54 PDT 2007


Steven Schveighoffer wrote:
> class X
> {
>   const int void f()
>   {
>     x += 5;
>     return x;
>   }
> }

"const int void f()" is clearly a bad declaration. Anyway, "const int 
f()" is a function returning a const int, not a const function returning 
an int, so you wouldn't be able to call it through a const reference.

  - Gregor Richards



More information about the Digitalmars-d mailing list