On Sat, 14 Aug 2010 20:28:56 -0500, sybrandy <[email protected]> wrote:
I can't recall if you can do this with structs, but if you use classes,
you should be able to define a "Date Part" class that has all of the
methods and data you want. Then, you just derive three sub-classes.
For example (and I hope the syntax is right):
class DatePart
{
this(int f)
{
_foo = f;
}
int asNumber() { return _foo; }
immutable int _foo;
}
class Year: DatePart {}
class Month: DatePart {}
class Day: DatePart {}
Casey
Yes. Unfortunately, I need to use structs because the types that I'm
defining are value types. But thanks for the answer
--
Yao G.