Best way to reference an array in a child class...

Ali Çehreli acehreli at yahoo.com
Thu Mar 6 11:47:49 PST 2014


On 03/06/2014 11:40 AM, Steven Schveighoffer wrote:

 >> class A
 >> {
 >>    S[]* pointer_to_list;
 >>    abstract...
 >> }

 > I would highly suggest to just use S[] and not S[]*. A slice is already
 > a reference (coupled with a length).

But what if there are elements added to B.items later on? I assumed the 
OP wanted a true reference.

 > You can read more about D arrays and slices here:
 >
 > http://dlang.org/d-array-article.html

My I suggest you do the same. :o)

 > -Steve

Ali



More information about the Digitalmars-d-learn mailing list