Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!vsi1!octopus!sjsumcs!horstman From: horstman@sjsumcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Double Dispatching (was: Re: c++ followup: abstract classes) Message-ID: <1990Dec20.014002.3833@sjsumcs.sjsu.edu> Date: 20 Dec 90 01:40:02 GMT References: <1990Dec18.214229.28951@Neon.Stanford.EDU> Reply-To: horstman@sjsumcs.SJSU.EDU (Cay Horstmann) Organization: San Jose State University Lines: 18 In article <1990Dec18.214229.28951@Neon.Stanford.EDU> philip@pescadero.stanford.edu writes: >In article , cline@cheetah.ece.clarkson.edu (Marshall Cline) writes: >|> Given N types of Operands, there'll be N^2 `add' routines: Int+Matrix, >|> Int+Sparse, Int+Int, etc. >Shouldn't that be N! (factorial)? >-- >Philip Machanick Indeed there are N^2. (N^k for a k-ary operation.) For example, if N ==2, there are Int * Int, Int * Matrix, Matrix * Int, Matrix * Matrix. (* is a lot more realistic that +, unless you like the APL interpretation). This question on double dispatching pops up every few months, so let me make a plug for my C++ book (Horstmann, Mastering C++, Wiley) which discusses it in the last chapter. Anything to get those royalty $$$ rolling... Cay