123456789101112131415161718192021222324252627282930 |
- <?php
- class boxed_int implements Comparable_Interface
- {
- protected $value;
- function __construct($n)
- {
- $this->value = $n;
- }
- function cmp(Comparable_Interface $other)
- {
- if ($this->value < $other->value)
- return -1;
- elseif ($this->value > $other->value)
- return 1;
- else
- return 0;
- }
- function as_int()
- {
- return $this->value;
- }
- }
|