home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / std / cplus / 2121 < prev    next >
Encoding:
Text File  |  1993-01-26  |  747 b   |  26 lines

  1. Path: sparky!uunet!olivea!decwrl!parc!ellis
  2. From: ellis@parc.xerox.com (John Ellis)
  3. Newsgroups: comp.std.c++
  4. Subject: Constructors and runtime typing
  5. Message-ID: <ellis.728022822@osric>
  6. Date: 26 Jan 93 04:33:42 GMT
  7. Sender: news@parc.xerox.com
  8. Organization: Xerox PARC
  9. Lines: 15
  10.  
  11. Regarding Stroustrup's proposal for runtime typing:
  12.  
  13. Suppose class B is derived from A and A's constructor calls typeof(*this):
  14.  
  15.     class A    {A() {...typeof(*this)...}; ...};
  16.     class B: A {...};
  17.  
  18. (Excuse any mistakes in notation.)
  19.  
  20. When "new B" is evaluated, will typeof(*this) yield typeof(A) or
  21. typeof(B)? 
  22.  
  23. The recommended implementation technique seems to suggest typeof(A),
  24. and that's consistent with the handling of virtual functions within
  25. constructors.  
  26.