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
On Sunday, 3 May 2015 at 17:46:54 UTC, Meta wrote:
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.
On
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
I'd make class A and class B into mixin templates instead.
mixin template A {
string a() { return foo; }
}
mixin template B {
string b() { return bar; }
}
class C {
mixin A;
mixin B;
}
If you still need class A and class B, just make a class that
mixes in the template for them
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 {};