Thread overview | |||||
---|---|---|---|---|---|
|
July 05, 2013 Visibility of variables in struct nested within a class | ||||
---|---|---|---|---|
| ||||
I have a class that defines a variable (root). Within it I have nested a struct. If I refer to that variable within the struct I get the message:
cbt2.d(760): Error: this for root needs to be type BTree not type Path
If I change the struct to a class, the error goes away, but I'd prefer to use a struct.
My computer is a 64bit Linux system with
DMD64 D Compiler v2.063
The particular statement referenced is:
if (root is null)
though there are many others.
Is this the way things are supposed to happen? (Changing the struct to a class is an OK patch, but I don't understand why it should either work or be necessary.)
--
Charles Hixson
|
July 08, 2013 Re: Visibility of variables in struct nested within a class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Hixson | Charles Hixson:
> Is this the way things are supposed to happen? (Changing the struct to a class is an OK patch, but I don't understand why it should either work or be necessary.)
Please show a complete very little program, and maybe someone will try to help you.
(Eventually it's a good idea to write a simple FAQ for D.learn, that also explains how to ask questions and how to give answers).
Bye,
bearophile
|
July 08, 2013 Re: Visibility of variables in struct nested within a class | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | > Please show a complete very little program, and maybe someone will try to help you.
I've seen there is code in another (broken) thread, so please ignore this request.
Bye,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation