home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / std / cplus / 2006 < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.7 KB  |  70 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: pointer comparisons
  5. Message-ID: <1993Jan8.181100.10727@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <1993Jan4.200625.5680@lucid.com> <9300812.4038@mulga.cs.mu.OZ.AU> <1993Jan8.150113.1643@lpi.liant.com>
  10. Date: Fri, 8 Jan 1993 18:11:00 GMT
  11. Lines: 57
  12.  
  13. In article <1993Jan8.150113.1643@lpi.liant.com> pkt@lpi.liant.com (Scott Turner) writes:
  14. >In article <9300812.4038@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  15. >> maxtal>    One consequence: abstract objects can exist.
  16. >> maxtal>
  17. >> maxtal>    Corollary: such objects have states not accessible via
  18. >> maxtal>    the contiguous storage allocated for them.
  19. >> maxtal>    (via virtual function calls)
  20. >> 
  21. >Since John MAX Skaller was drawing inferences from my belief that base
  22. >class subobjects are objects, I want to go on record.  I agree that
  23. >"abstract objects" can exist, but the corollary does not follow.  
  24. >
  25. >In the corollary, John MAX Skaller is referring to a different scenario
  26. >in which the object of abstract class is a base class subobject of a
  27. >fully-constructed enclosing object.  He concludes that the state of the 
  28. >enclosing object is part of the state of the base class subobject.  The
  29. >reasoning has something to do with the additional state being accessible via
  30. >virtual function calls, but there's a big hole in it.  Virtual functions 
  31. >(and non-virtual functions) can access any number of other objects,
  32. >independent of the object for which they are called.
  33.  
  34.     Um: globally defined objects yes.
  35.     What else?
  36.  
  37.     Well, you can have a pointer to another object in an object,
  38. and access the other object via the pointer, right?
  39.  
  40.     But this doesn't count :-) The pointer is part
  41. of the state of the object, and thus so is the object pointed
  42. to (and so on recursively)
  43.  
  44.     In any case, I will fill in the hole:
  45.  
  46.     class X {
  47.     public:
  48.         virtual int f()=0;
  49.     };
  50.  
  51.     class Y : public X {
  52.         int i;
  53.     public:
  54.         int f() {return i;}
  55.         void setint(int j) {i=j;}
  56.     };
  57.  
  58. In this single example, the abstract subobject X in Y has
  59. public states  of measure 'int'. (There are 'int' values).
  60. Yet X has private storage of measure zero.
  61.  
  62. Where is the hole in this argument? Answer: X has a vtble
  63. pointer!  So I'm wrong. I concede.
  64.  
  65. -- 
  66. ;----------------------------------------------------------------------
  67.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  68.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  69. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  70.