Getting access to the variables of an imported class

jicman cabrera_ at _wrc.xerox.com
Sun Dec 6 10:56:38 PST 2009


Daniel Keep Wrote:
> 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.  :|

Or don't know how to read them :/... :-)  But, I just learned... Next time I get it.

> > 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'.

Thanks.  I got it and I just learned something new today. :-)

jic





More information about the Digitalmars-d-learn mailing list