On Sun, Oct 9, 2011 at 7:44 AM, Paul Bennett <paul.w.benn...@gmail.com>wrote:
> On Sun, 09 Oct 2011 10:34:46 -0400, Leon Timmermans <faw...@gmail.com> > wrote: > > I think the obvious mistake you're making is using inheritance in the >> first place. Why are you doing that? Your interface is not «an IP >> address is really a number», so why would you make it one? >> > > Ah, but an IP address *is* really a number. An unsigned 128-bit integer, in > fact, with some additional properties that are specific to the semantics of > IP addresses themselves. > An unsigned base 256 4-digit number, perhaps.... > > True, certain operations (multiplication and division spring to mind) are > -- probably -- bad ideas, but addition, subtraction, bitwise operations, > bitshifting, comparison (including range comparison and sorting), and many > other good numbery things definitely apply. > > > > -- > Paul Bennett (PWBENNETT) > -- Check out my LEGO blog at http://www.brickpile.com/ View my photos at http://flickr.com/photos/billward/ Follow me at http://twitter.com/williamward