cannot modify struct with immutable members
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 3 01:16:29 PST 2015
On Sat, 03 Jan 2015 01:00:58 -0800
Ali Çehreli via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:
> On 01/02/2015 09:07 PM, ketmar via Digitalmars-d-learn wrote:
>
> > structure instance with const fields can be initialized only once, upon
> > creation. so did `Test myTest1;` -- you initialized `myTest1` with
> > default values. you can't reinitialize it later.
> >
> > in C++ constness on member doesn't impose such restrictions.
>
> C++ has the same restriction: const members make objects unassignable:
ah, thanks. it's a joy to forgetting C++ to this extent. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150103/b457b80a/attachment.sig>
More information about the Digitalmars-d-learn
mailing list