www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Inherit from global scope class in nested

reply "Ilya Zaitseff" <sark7 mail333.com> writes:
Why such is disallowed?

class Foo {
   static class Foo {
   	static int x;
   }

   static class Bar: .Foo
   {
   }
}

I found workaround, but I'm wondering why the above code doesn't compiles.

class Foo {
   static class Foo {
   	static int x;
   }

   alias .Foo gFoo;

   static class Bar: gFoo
   {
   }
}
Aug 28 2005
parent James Dunne <james.jdunne gmail.com> writes:
In article <op.sv8t4kggaaezs2 ilya.tec.amursk.ru>, Ilya Zaitseff says...
Why such is disallowed?

class Foo {
   static class Foo {
   	static int x;
   }

   static class Bar: .Foo
   {
   }
}

I found workaround, but I'm wondering why the above code doesn't compiles.

class Foo {
   static class Foo {
   	static int x;
   }

   alias .Foo gFoo;

   static class Bar: gFoo
   {
   }
}
Probably because it is an obscure usage of the dot operator as a global scope operator and it was forgotten to be implemented. Besides, it's probably a mark of bad style. Regards, James Dunne
Aug 28 2005