On Sunday, 3 May 2015 at 17:35:42 UTC, Dennis Ritchie wrote:
Hi,
How can I rewrite this code to the D?
-----
#include <string>
#include <iostream>
class A {
public:
std::string a() {
return std::string("foo");
}
};
class B {
public:
std::string b(){
return std::string("bar");
}
};
class C : public A, public B {};
int main () {
C c;
std::cout << c.a() << c.b() << std::endl;
return 0;
}
This is not really doable right now in D. You can forward the
function calls to a and b easily enough, but you can't inherit
from more than one class. Once the multiple alias this patch gets
merged you will be able to do this in D.