D vs. C#
Hasan Aljudy
hasan.aljudy at gmail.com
Thu Nov 23 21:27:59 PST 2006
Julio César Carrascal Urquijo wrote:
>
<snip>
>
> C# has partial classes witch allows split a class in several files. This
> can be handy, for example, for a code generator to safely modify a file
> while the user modifies another for the same class. D doesn't has any
> way of doing this.
>
Actually, I think you can achieve the same effect in D using mixins.
--------------
template CodeGenerator_Class_Part()
{
//declarations ...
}
--------------
template Class_Coder_Part()
{
//declarations
}
--------------
class Class
{
mixin CodeFenerator_Class_Part!();
mixin Class_Coder_Part!();
}
--------------
I think each of these can be in a separate file.
More information about the Digitalmars-d
mailing list