partial class
Julio César Carrascal Urquijo
jcarrascal at gmail.com
Sat Nov 1 15:54:18 PDT 2008
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();
}
}
More information about the Digitalmars-d
mailing list