Partial classes
bls
bizprac at orange.fr
Mon Jan 30 02:21:06 PST 2012
On 01/29/2012 01:43 PM, Mars wrote:
> Hello everybody.
> Quick question, is there anything like C#'s partial classes in D?
>
> Mars
As already said template mixins are close to partial classes.
A snippet. HTH
import std.stdio, std.cstream;
void main(string[] args)
{
auto bar = new Bar();
writeln(bar.onClick());
// Lets the user press <Return> before program stops
din.getc();
}
mixin template FooMixin()
{
void initCommonControls()
{
}
string onClick()
{
return "Clicked";
}
}
class Foo
{
mixin FooMixin;
}
class Bar : Foo
{
}
More information about the Digitalmars-d-learn
mailing list