Article View: comp.std.c++
Article #1719Re: Calling ctors. from ctors.
From: Ed Osinski
Date: Sun, 13 Aug 1995 23:10
Date: Sun, 13 Aug 1995 23:10
34 lines
1760 bytes
1760 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:
<MATT.95Aug13161055@physics2.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<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!128.32.155.1!matt From: osinski@valis.cs.nyu.edu (Ed Osinski) Newsgroups: comp.std.c++ Subject: Re: Calling ctors. from ctors. Date: 13 Aug 1995 23:10:55 GMT Organization: New York University Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <MATT.95Aug13161055@physics2.Berkeley.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: physics2.berkeley.edu