home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:11652 comp.std.c++:968
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmb
- From: tmb@arolla.idiap.ch (Thomas M. Breuel)
- Newsgroups: comp.lang.c++,comp.std.c++
- Subject: mating dogs and cats (Re: run-time type checking)
- Message-ID: <TMB.92Jul28121957@arolla.idiap.ch>
- Date: 28 Jul 92 16:19:57 GMT
- References: <1992Jul21.162659.25474@ucc.su.OZ.AU>
- <1992Jul22.022218.1115@cadsun.corp.mot.com>
- <1992Jul23.154254.5306@ucc.su.OZ.AU>
- Sender: news@ai.mit.edu
- Reply-To: tmb@idiap.ch
- Followup-To: comp.lang.c++
- Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
- Perceptive)
- Lines: 41
- In-reply-to: maxtal@extro.ucc.su.OZ.AU's message of 23 Jul 92 15:42:54 GMT
-
- In article <1992Jul23.154254.5306@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
-
- The problem is why you proposed 'thisclass' and is a real problem.
- It is a problem for which RTTI is the wrong solution,
- but never-the-less is the best we will get for a while.
- We really need multiple dispatch.
-
- class Animal {
- int mate(Animal&);
- };
- class Dog : Animal {
- int mate (Animal&);
- };
-
- We REALLY want Dog::mate(Dog&), but we cant have it.
-
- I don't see the problem.
-
- class Animal {
- virtual int mate(Animal &) = 0;
- virtual int mate_dog(Animal &other) {error("not a dog");}
- virtual int mate_cat(Animal &other) {error("not a cat");}
- };
-
- class Dog {
- int mate(Animal &other) {return mate_dog(other);}
- int mate_dog(Animal &other) { ... do it the way dogs do it ... }
- };
-
- This is a flaw in Object Oriented Programming IMHO.
- The solution requires multimethods which are inherently
- functional.
-
- I don't see that this particular thing is a flaw with Object Oriented
- programming. Nor do you need RTTI to solve this problem.
-
- I assume that by "functional" you mean "CLOS-style methods". I agree
- that they are more convenient and easier to maintain, but at least in
- this respect, they don't give you more functionality.
-
- Thomas.
-