On Thu, 06 Mar 2014 14:31:52 -0500, captain_fid <[email protected]> wrote:
On Thursday, 6 March 2014 at 19:19:29 UTC, captain_fid wrote:
Sorry for the very basic question. Much still alludes me with this
language. I appreciate the forum.
struct S
{
Wow sorry for that. I'm a moron... don't press <tab> <enter>...
struct S
{
int a;
string b;
}
class A
{
S[]* pointer_to_list;
abstract...
}
class B: A
{
S[] items = [ {10, "first"}, {20, "second"}];
this() {
pointer_to_list = &items;
}
}
My problem is in de-referencing later (seg fault). Is this even the best
way?
I Really need to access the array in a derived class. 'S' (I believe)
really is best as a Structure.
Any suggestions. Thanks in advance (and sorry for the rough start).
I would highly suggest to just use S[] and not S[]*. A slice is already a
reference (coupled with a length).
You can read more about D arrays and slices here:
http://dlang.org/d-array-article.html
-Steve