multiple inheritance
Namespace
rswhite4 at googlemail.com
Sun Jul 8 11:09:13 PDT 2012
I made a compromise:
[code]
import std.stdio;
interface Transformable {
public:
void transform();
}
mixin template Transform() {
public:
this() {
writeln("Transform Ctor");
}
void transform() {
writeln("transformiere");
}
}
abstract class Drawable {
public:
void draw() {
writeln("zeichne");
}
}
class Shape : Drawable, Transformable {
public:
mixin Transform;
this() {
writeln("Shape CTor");
}
}
void test_drawable(Drawable d) {
d.draw();
}
void test_transformable(Transformable t) {
t.transform();
}
void main() {
Shape s = new Shape();
test_drawable(s);
test_transformable(s);
}
[/code]
Any suggestions?
More information about the Digitalmars-d-learn
mailing list