home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18900 < prev    next >
Encoding:
Internet Message Format  |  1993-01-10  |  1.6 KB

  1. Path: sparky!uunet!ogicse!emory!wupost!usc!news.cerf.net!nic.cerf.net!hlf
  2. From: hlf@nic.cerf.net (Howard Ferguson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Restatement and clarification of "static inheritance" question
  5. Keywords: inheritance
  6. Message-ID: <1ipp5oINNg0e@news.cerf.net>
  7. Date: 10 Jan 93 18:16:24 GMT
  8. Article-I.D.: news.1ipp5oINNg0e
  9. References: <1993Jan8.174434.7714@ucc.su.OZ.AU> <1ikg2tINN2d3@news.cerf.net> <1993Jan9.154850.5939@ucc.su.OZ.AU>
  10. Organization: CERFnet Dial n' CERF Customer Group
  11. Lines: 31
  12. NNTP-Posting-Host: nic.cerf.net
  13.  
  14. In article <1993Jan9.154850.5939@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. >In article <1ikg2tINN2d3@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
  16. >>>>WHAT I AM INTERESTED IN IS THE FUNCTIONALITY OF "COUNTING ONE'S
  17. >>>>OWN INSTATIATIONS", NOT COUNTING THE TOTALITY OF ALL INSTATIATIONS OF
  18. >>>>CLASS A. 
  19.  -- stuff deleted --
  20. >>
  21. >>I still do not see a reason for inheritance when containment will do.
  22. >>Can anybody clarify this???
  23. >>
  24. >
  25. >    Sure. If you use containment you end up counting
  26. >subobjects of the base classes too:
  27. >
  28. >    class X { A<X> ax; };
  29. >    class Y { A<Y> ay; };
  30. >    class Z { A<Z> az; };
  31. >
  32. >    Z z;
  33. >
  34. >// WOOPS: now we count 1 Z (correct) and 1 X and 1 Y (wrong)
  35.  
  36. Have you missunderstood, and thought that there is only one static
  37. created for all of the A's. (I think) you are wrong here. The template
  38. semantics create one static for each class and A<X> is a different class
  39. from A<Y> so thge result would be 1 Z , zero X's, and zero Y's.
  40.  
  41. ( Again I do not have a templating compiler yet so somebody please
  42. correct me if I am wrong on this one.)
  43.  
  44.     hlf
  45.