Head Const

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 17 10:16:54 PST 2016


On Wednesday, 17 February 2016 at 17:47:02 UTC, Jonathan M Davis 
wrote:
> definitely sucks. But interestingly, the more I've used D, the 
> less happy I've been with C++'s const. It just has too many 
> holes. In particular, the fact that it's not transitive is

What you could consider in C++ is to fully encapsulate your field 
values and use member functions to access them. Which is 
considered good modelling anyway.

So if you access a member as "get_child() const", you return a 
const reference, which makes it transitive.

What is annoying in C++ is that there is no getter/setter 
syntax...



More information about the Digitalmars-d mailing list