On Mon, 18 Oct 2010 15:47:40 -0400, Mike Chaten <mcha...@gmail.com> wrote:

In C++ it is possible to declare a class as follows
class Foo {
Foo(int x) { }
}
You can then use that constructor to implicitly convert int to Foo. E.g
Foo x = 0; //equivalent to Foo(0)

Is there a way in D to do an implicit or explicit conversion from an
integral type to a class?

explicit cast == opCast
implicit cast == alias this

Look up those two features in the docs.

-Steve

Reply via email to