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.

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)

Reply via email to