home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 20100 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.5 KB  |  71 lines

  1. Path: sparky!uunet!seismo!darwin.sura.net!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!sgiblab!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  2. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Mixins
  5. Message-ID: <1993Jan26.222925.8025@ucc.su.OZ.AU>
  6. Date: 26 Jan 93 22:29:25 GMT
  7. References: <24656@alice.att.com> <1993Jan21.005415.2812@ucc.su.OZ.AU> <1993Jan22.121031.11305@actrix.gen.nz>
  8. Sender: news@ucc.su.OZ.AU
  9. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  10. Lines: 58
  11. Nntp-Posting-Host: extro.ucc.su.oz.au
  12.  
  13. In article <1993Jan22.121031.11305@actrix.gen.nz> chris@actrix.gen.nz (Chris Double) writes:
  14. >In article <1993Jan21.005415.2812@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >> 
  16. >>     But your greatest achievement, Bjarne, in my opinion,
  17. >> was the name dominance rule, because, coupled with virtual
  18. >> bases and abstract classes that enables mixins.
  19. >> 
  20. >
  21. >Hi.
  22. >
  23. >I've read a lot on this newsgroup about how good mixins are but how
  24. >some compilers don't support them.
  25. >
  26. >I've never come across this term before. Would somebody be able to
  27. >explain what the 'mixin' concept is?
  28.  
  29.     Sort of 'tailor made classes'. Brew em up as you need
  30. them. Sorry-I'll have to prepare a standard answer to this.
  31. A moderate sized demo is in the works.
  32.  
  33. >
  34. >Also what is wrong with the compilers that don't support it. I
  35. >understand Borland doesn't. So what isn't borland doing that it
  36. >should?
  37. >
  38.  
  39. // RE Abstract Classes
  40. // some compilers work and others fail when #define KLUDGE is 
  41. // commented out. Some say D is abstract.
  42. // CLEARLY it is not.
  43. // However rewiting rules in ARM are not clear.
  44. // It is essential for "mix-in" programming that D is concrete.
  45. //
  46. #define KLUDGE
  47. #ifndef KLUDGE
  48. class V {public: virtual void f()=0; virtual void g()=0;};
  49. #else
  50. class V {public: virtual void f(){printf("ERROR V::g\n");} 
  51.     virtual void g(){printf("ERROR V::g\n");}};
  52. #endif
  53. class A1 : public virtual V {public: void f(){printf("A1::f\n");}};
  54. class A2 : public virtual V {public: void g(){printf("A2::g\n");}};
  55. class D : public A1, public A2 {};
  56. int main()
  57. {
  58.     D* d=new D;
  59.     A1 * a1=d;
  60.     A2 * a2=d;
  61.     V * v = d;
  62.     d->f(); a1->f(); a2->f(); v->f();
  63.     d->g(); a1->g(); a2->g(); v->g();
  64. }
  65.  
  66. -- 
  67. ;----------------------------------------------------------------------
  68.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  69.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  70. ;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph:  2 799 8223 --------
  71.