home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!emory!wupost!usc!news.cerf.net!nic.cerf.net!hlf
- From: hlf@nic.cerf.net (Howard Ferguson)
- Newsgroups: comp.lang.c++
- Subject: Re: Restatement and clarification of "static inheritance" question
- Keywords: inheritance
- Message-ID: <1ipp5oINNg0e@news.cerf.net>
- Date: 10 Jan 93 18:16:24 GMT
- Article-I.D.: news.1ipp5oINNg0e
- References: <1993Jan8.174434.7714@ucc.su.OZ.AU> <1ikg2tINN2d3@news.cerf.net> <1993Jan9.154850.5939@ucc.su.OZ.AU>
- Organization: CERFnet Dial n' CERF Customer Group
- Lines: 31
- NNTP-Posting-Host: nic.cerf.net
-
- In article <1993Jan9.154850.5939@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- >In article <1ikg2tINN2d3@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
- >>>>WHAT I AM INTERESTED IN IS THE FUNCTIONALITY OF "COUNTING ONE'S
- >>>>OWN INSTATIATIONS", NOT COUNTING THE TOTALITY OF ALL INSTATIATIONS OF
- >>>>CLASS A.
- -- stuff deleted --
- >>
- >>I still do not see a reason for inheritance when containment will do.
- >>Can anybody clarify this???
- >>
- >
- > Sure. If you use containment you end up counting
- >subobjects of the base classes too:
- >
- > class X { A<X> ax; };
- > class Y { A<Y> ay; };
- > class Z { A<Z> az; };
- >
- > Z z;
- >
- >// WOOPS: now we count 1 Z (correct) and 1 X and 1 Y (wrong)
-
- Have you missunderstood, and thought that there is only one static
- created for all of the A's. (I think) you are wrong here. The template
- semantics create one static for each class and A<X> is a different class
- from A<Y> so thge result would be 1 Z , zero X's, and zero Y's.
-
- ( Again I do not have a templating compiler yet so somebody please
- correct me if I am wrong on this one.)
-
- hlf
-