Overriding mixed-in virtual functions
    Hasan Aljudy 
    hasan.aljudy at gmail.com
       
    Thu Nov 16 12:31:16 PST 2006
    
    
  
Max Samuha wrote:
> Is there a way to disambiguate the mixed-in virtual functions in a
> derived class?
> 
> template TFoo
> {
> 	void bar()
> 	{		
> 	}
> }
> 
> class Base
> {
> 	TFoo A;
> 	TFoo B;
> }
> 
> class Code : Base
> {
> 	override void bar(); // bad idea;	
> }
> 
> Maybe I'm asking for too much, but it would be nice to be able to do
> something like this:
> 
> class Code : Base
> {
> 	override void A.bar()
> 	{
> 	}
> 
> 	override void B.bar()
> 	{
> 	}
> }
It would be nice if there was a "namespace" keyword.
class Code : Base
{
     namespace A
     {
          override void bar() {...} //Yatta!
     }
}
and, a mixin name
     mixin TFoo A;
can be just a short cut for:
     namespace A
     {
         mixin TFoo;
     }
    
    
More information about the Digitalmars-d
mailing list