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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!titan!lpi!pkt
  3. From: pkt@lpi.liant.com (Scott Turner)
  4. Subject: Re: pointer comparisons
  5. Message-ID: <1993Jan11.192337.5368@lpi.liant.com>
  6. Sender: pkt@lpi (Scott Turner)
  7. Organization: Liant Software Corporation
  8. References: <1993Jan4.200625.5680@lucid.com> <9300812.4038@mulga.cs.mu.OZ.AU> <1993Jan8.150113.1643@lpi.liant.com> <1993Jan8.181100.10727@ucc.su.OZ.AU>
  9. Date: Mon, 11 Jan 1993 19:23:37 GMT
  10. Lines: 50
  11.  
  12. In article <1993Jan8.181100.10727@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  13. > In article <1993Jan8.150113.1643@lpi.liant.com> pkt@lpi.liant.com (Scott Turner) writes:
  14. > >> maxtal>    Corollary: such objects have states not accessible via
  15. > >> maxtal>    the contiguous storage allocated for them.
  16. > >> maxtal>    (via virtual function calls)
  17. > >> 
  18. > >Since John MAX Skaller was drawing inferences from my belief that base
  19. > >class subobjects are objects, I want to go on record.  I agree that
  20. > >"abstract objects" can exist, but the corollary does not follow.  
  21. >     Well, you can have a pointer to another object in an object,
  22. > and access the other object via the pointer, right?
  23. >     But this doesn't count :-) The pointer is part
  24. > of the state of the object, and thus so is the object pointed
  25. > to (and so on recursively)
  26. >     In any case, I will fill in the hole:
  27. >     class X {
  28. >     public:
  29. >         virtual int f()=0;
  30. >     };
  31. >     class Y : public X {
  32. >         int i;
  33. >     public:
  34. >         int f() {return i;}
  35. >         void setint(int j) {i=j;}
  36. >     };
  37. >  
  38. > In this single example, the abstract subobject X in Y has
  39. > public states  of measure 'int'. (There are 'int' values).
  40. > Yet X has private storage of measure zero.
  41. > Where is the hole in this argument? Answer: X has a vtble
  42. > pointer!  
  43.  
  44. Yes, that's close to the way I look at it.  X declares a virtual function f
  45. with the consequence that any subobject of type X includes
  46. some indication of how f has been overridden in constructing the enclosing
  47. object.   f may refer to non-contiguous storage, but that's no more
  48. problematic than if X had a pointer member which refers to non-contiguous
  49. storage.
  50. --
  51. Prescott K. Turner, Jr.
  52. Liant Software Corp. (developers of LPI languages)
  53. 959 Concord St., Framingham, MA 01701 USA    (508) 872-8700
  54. UUCP: uunet!lpi!pkt                          Internet: pkt@lpi.liant.com
  55.  
  56.