partial class
    KennyTM~ 
    kennytm at gmail.com
       
    Fri Oct 31 10:06:42 PDT 2008
    
    
  
Denis Koroskin wrote:
> On Fri, 31 Oct 2008 17:37:42 +0300, Mike James <foo at bar.com> wrote:
> 
>> Not sure if this has been suggested before as an addition to D but 
>> what about introducing a partial class as per C# - with all the 
>> benefits it would bring...
>>
>> -=mike=-
> 
> 
> I must be missing something, but D already supports defining class 
> methods in one file and implementing them in another one.
Something like this:
partial class A {
     int someMember;
     public A(int x) { someMember = x; }
}
// Far, far apart
partial class A {
     public int getSomeMember() { return someMember; }
}
class X {
     static void Main() {
         var someA = new A(12);
         System.Console.WriteLine(someA.getSomeMember());
     }
}
    
    
More information about the Digitalmars-d
mailing list