>       class myobj {
>               ...
>               int a,b,c;
>               myobj(int aa, int bb, int cc) :
>                       a(aa), b(bb), c(cc) const {}
>               ...
>       };

Ummm no. Straight from Bjarne: "You can't have a const constructor." You 
just do what you did without the const. A const myobj is essentially 
equivalent (with the exception of not being allowed to call methods not 
marked 'const', except the constructor) to:

        class myobj {
                const ...
                const int a,b,c;
`               myobj(int aa, int bb, int cc) :
                        a(aa),b(bb),c(cc) { }
        };

So you're initializing the const variables just like you would instance 
consts. The constructor can't alter them, but the initializer (thing 
before the constructor) can.

But, this isn't a C++ list, so on to Perl. I should certainly hope you can 
have instance constants. They can be quite useful, though optimization 
doesn't work as well for them.

Oh, and just so you know, I'm basically a C++ linguist. I have practically 
memorized Bjarne's The C++ Programming Language. And by that, I maintain 
that C++ is the _best_ compiled language. Or at least in my opinion.

Luke

Reply via email to