Comment on Bertrand Meyer's Multiple Inheritance example at the .net seminar

Colin,

Firstly, when matrices inherit from NUMERIC, the class designer

has to define what is meant by matrix division and matrix

exponentiation.

Neither of these is really defined in mathematics, and of course you can

just make the preconditions (divisible and exponentiable) return False

in all cases anyway. In the matrix class I wrote for work, which only

contains the basics (no inversion), I did not inherit from NUMERIC. We

just don't need that capability.

Secondly, what is meant by matrix comparison? How would you

define one matrix being less than another? Is each element less than

its corresponding element? Would you compare determinants on square

matrices? You'd have to come up with some method that clients can

easily

understand. I should note that these issues surface with vectors as

well,

which are very related to matrices. My vector class is neither NUMERIC

nor COMPARABLE.

Finally, I do not think that NUMERIC should inherit from

COMPARABLE, using the above as examples. Also, I have a class that

describes trigonometric angles (in an odd but very useful way) that

inherits from NUMERIC, but is only partially comparable

(PART_COMPARABLE).

I would run into a problem here if NUMERIC inherited from COMPARABLE.

Steve Wurster

Quote:

> Bertrand gives an example of multiple inheritance in which integer, double

> and real each inherit from both comparable and numeric; string inherits from

> comparable; matrix inherits from numeric.

> I don't see why matrices can't be comparable: after all, addition of

> matrices results in a matrix of added elements, so comparison would result

> in a matrix of boolean values.

> Then numeric can inherit from comparable, no MI is needed.

> --

> Colin Sutton

> Development Manager, Access Control Systems

> Siemens Building Technologies Pty. Ltd.

> 14-18 Suakin Street, Pymble NSW 2073 Australia

> Phone +61 2 98551310 Fax +61 2 98551301

--

Steven M. Wurster

http://members.home.net/wurster

The computer is incredibly fast, accurate, and stupid.

Man is unbelievably slow, inaccurate, and brilliant.

The marriage of the two is a force beyond calculation.

-- Leo Cherne