Article View: comp.std.c++
Article #1654Re: Calling ctors. from ctors.
From: Ed Osinski
Date: Tue, 08 Aug 1995 00:15
Date: Tue, 08 Aug 1995 00:15
33 lines
1690 bytes
1690 bytes
In article <4035hm$g7s@ixnews7.ix.netcom.com>, rameshs@ix.netcom.com (Ramesh Seshadri ) writes:
|> I also like this feature. But in C++ if we link some features with
|> someother one finally we are ending up with some ambiguities. OK. Here
|> what should be the behaviour for the following code ?
|>
|> struct Base
|> {
|> Base () { ... }
|> Base (int) { ... }
|> }
|>
|> struct Derv : Base
|> {
|> Derv () : Base () { ... }
|> Derv (int nVal) : Derv (), Base (nVal) { ... }
|> }
|>
|> My question:
|> What should happen when the Derv class ctor with int argument is
|> getting called ?
It ought to result in a compile-time error. If you want a different
constructor to be called, I would be very surprised if initialization
of base classes and data members were not done by the other
constructor.
---------------------------------------------------------------------
Ed Osinski
Computer Science Department, New York University
E-mail: osinski@cs.nyu.edu
---------------------------------------------------------------------
"No, no, no, don't tug on that. You never know what it might be attached to."
-- Buckaroo Bonzai to assistant during brain surgery
Technical Details
Message-ID:
<406abl$t3i@cmcl2.NYU.EDU>Path:
arc1-ca.pugleaf.net!valis.cs.nyu.edu!osinskiReferences:
<3v5lo9$pql@usenet.rpi.edu> <3vqm8o$g7f@hrz-ws11.hrz.uni-kassel.de> <4035hm$g7s@ixnews7.ix.netcom.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!valis.cs.nyu.edu!osinski From: osinski@valis.cs.nyu.edu (Ed Osinski) Newsgroups: comp.std.c++ Subject: Re: Calling ctors. from ctors. Date: 8 Aug 1995 00:15:49 GMT Organization: New York University Message-ID: <406abl$t3i@cmcl2.NYU.EDU> References: <3v5lo9$pql@usenet.rpi.edu> <3vqm8o$g7f@hrz-ws11.hrz.uni-kassel.de> <4035hm$g7s@ixnews7.ix.netcom.com> Reply-To: osinski@cs.nyu.edu NNTP-Posting-Host: valis.cs.nyu.edu