Article View: comp.std.c++
Article #1368Constructors and runtime typing
From: John Ellis
Date: Tue, 26 Jan 1993 04:33
Date: Tue, 26 Jan 1993 04:33
15 lines
772 bytes
772 bytes
Regarding Stroustrup's proposal for runtime typing:
Suppose class B is derived from A and A's constructor calls typeof(*this):
class A {A() {...typeof(*this)...}; ...};
class B: A {...};
(Excuse any mistakes in notation.)
When "new B" is evaluated, will typeof(*this) yield typeof(A) or
typeof(B)?
The recommended implementation technique seems to suggest typeof(A),
and that's consistent with the handling of virtual functions within
constructors.
Technical Details
Message-ID:
<ellis.728022822@osric>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!decwrl!parc!ellisShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!decwrl!parc!ellis From: ellis@parc.xerox.com (John Ellis) Newsgroups: comp.std.c++ Subject: Constructors and runtime typing Message-ID: <ellis.728022822@osric> Date: 26 Jan 93 04:33:42 GMT Sender: news@parc.xerox.com Organization: Xerox PARC Lines: 15