Visibility of variables in struct nested within a class
Charles Hixson
charleshixsn at earthlink.net
Fri Jul 5 13:43:27 PDT 2013
On 07/05/2013 11:25 AM, H. S. Teoh wrote:
> On Fri, Jul 05, 2013 at 11:19:53AM -0700, Charles Hixson wrote:
>> 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.)
> [...]
>
> Could you post some sample code that shows the problem? It's a bit hard
> to tell what's happening without seeing the actual code.
>
>
> T
>
class Outer
{ int inn;
struct InnerS
{ int able;
void setable()
{ able = inn; }
} // InnerS
} // Outer
void main()
{
}
--
Charles Hixson
More information about the Digitalmars-d-learn
mailing list