partial class
    Ary Borenszweig 
    ary at esperanto.org.ar
       
    Sat Nov  1 16:27:46 PDT 2008
    
    
  
Julio César Carrascal Urquijo escribió:
> Hello Ary,
> 
>> Mike James escribió:
>> Julio's second example convinced me that partial classes are useful.
>> But in D you can already do that, sort of:
> 
> 
> Yes that's possible right now but, sadly, it can't do this:
> 
> class Foo
> {
>     mixin GeneratedFoo!();
> }
> 
> // far, far away
> template GeneratedFoo()
> {
>     void three() { }
>     void four()
>     {         one();    // Might not be implemented by the class
>     }
> }
> 
> Which means that Foo has to be polluted with default implementations of 
> every partial method. In C# the user can decide which methods to implement:
> 
> // Controlled by the user.
> partial class Foo
> {
> }
> 
> // Controlled by the tool.
> partial class Foo
> {
>     partial void one();
> 
>     void four()
>     {
>         one();
>     }
> }
Wow, I didn't know there were also partial methods. Something new. :-)
    
    
More information about the Digitalmars-d
mailing list