dlang-book/book/06-классы-объектно-ориентированный-стиль/src/chapter-6-3-1/app.d

23 lines
241 B
D

import std.math;
class Test
{
double a = 0.4;
double b;
this(int b)
{
this.b = b;
}
this() {}
}
unittest
{
auto t = new Test(5);
auto z = new Test;
assert(t.b == 5);
assert(isNaN(z.b));
}