shared Id!Service id ()() const if (is (typeof(this) == shared)) { return (cast(Service)this).id; } Id!Service id () const { return service_id; }
I like this better than casting at the callsite (though it would be nice to roll those two into one method using a static if somehow, but I can't think of any way to do this).