🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3495

Re: Calling X(int) from X()'s init list

#3495
From: David Byrden
Date: Sun, 25 Feb 1996 16:44
32 lines
1417 bytes


<<<<<<<

Why is it not allowed to delegate the initialisation to another
constructor

class X
{
public:
    X (int i) : i_(i) {}

    X () : X(34) {}             // Not allowed
>>>>>>>>>


     Why not use      X (int i = 34 ) : i_(i) {}


                      David

[ I think he was concerned with the more general case of a complicated
  initialization (not assignment) that must be repeated for each
  constructor. -sdc, moderator
]
[ To submit articles: Try just posting with your newsreader.
		      If that fails, use mailto:std-c++@ncar.ucar.edu
  FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID: <4gognf$et@news.bridge.net>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <4gnush$phg@news.kth.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: David Byrden <100101.2547@compuserve.com>
Newsgroups: comp.std.c++
Subject: Re: Calling X(int) from X()'s init list
Date: 25 Feb 1996 16:44:44 GMT
Organization: self-employed
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <4gognf$et@news.bridge.net>
References: <4gnush$phg@news.kth.se>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Nntp-Posting-Host: ppp-mia2-77.bridge.net
X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
Content-Length: 275
Originator: clamage@taumet