digitalmars.D.bugs - classes in functions
- h3r3tic (46/46) Jun 02 2004 the following code:
the following code:
------------------------------------------
void f1()
{
class foo
{
}
}
void f2()
{
class foo
{
public int a;
}
foo x = new foo;
x.a = 0;
}
void main()
{
f1();
f2();
}
------------------------------------------
causes an error:
no property 'a' for type 'foo'
if the definition of class foo in function f1 is removed, there's no error.
seems like classes defined in functions were put to a global scope but
without any redefinition errors and yet this isnt possible:
void f1()
{
class foo
{
public int a;
}
}
void f2()
{
foo x = new foo;
x.a = 0;
}
void main()
{
f1();
f2();
}
hope this helps
Jun 02 2004








"h3r3tic" <aintmymail foo.bar>