Getting access to the variables of an imported class

Daniel Keep daniel.keep.lists at gmail.com
Sat Dec 5 21:29:14 PST 2009


jicman wrote:
> aalm Wrote:
>> import dfl.all;
>> import myform2;
>>  
>> void main()
>> {
>>   //Form d = new MyForm();
>>   //MyForm d = new MyForm();
>>   auto d = new MyForm();
>>   d.text = "Hello...";
>>   d.Name.text = "name";
>>   d.show();
>> }
> 
> thanks.  That worked.  Would you care to explain? :-)  I know what auto does, but I thought that a Form was a form and a Class was a class.  Does auto here would suffice for all other kinds of variables?
> 
> Thanks for the help.
> 
> jos�

Sometimes, I think all compiler errors should be replaced with
"Something went wrong."  No one ever seems to *read* them.  :|

> testDFL.d(8): Error: no property 'Name' for type 'dfl.form.Form'

You were trying to access a 'Name' property for an object of type
'Form'.  But 'Form's do not have a 'Name' property.  Objects of type
'MyForm' do, but you've explicitly told the compiler that 'd' is of type
'Form' not 'MyForm'.


More information about the Digitalmars-d-learn mailing list