🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#3537
From: Etay Bogner
Date: Wed, 28 Feb 1996 16:16
51 lines
2278 bytes
In article <Etay_Bogner-2702961023450001@metay.stil.scitex.com>,
Etay_Bogner@mail.stil.scitex.com (Etay Bogner) wrote:
<< My inclination, although I rarly use const or reference data members, will
<< be to wrap those data members in an internal structure with it's own
<< constructor :
<< 
<< class A_Class_With_A_Const_Or_Refs {
<<     A_Class_With_A_Const_Or_Refs(long& l);
<<     struct internal_Data {
<<         long& mLong;
<<         const long mClassID; // when there was no RTTI, for instance
<<         internal_Data(long& inLong, const long inID);
<<         } mInternalData;
<<     };
<< 
<< A_Class_With_A_Const_Or_Refs::A_Class_With_A_Const_Or_Refs(long& l) :
<< mInternalData(l, 'MYID') {}
<< 
<< and so on.

I think it may be unclear :

my suggestion is that one can write a *lot* of constructors, and they can
call the internal constructor, which has the same effect as calling :

class X {
    X(long);
    X(char*);
    };

X::X(char* c) : X(1) {}

Which is the desired behavior.

-- 
-- Etay Bogner
-- Etay_Bogner@mail.stil.scitex.com
-- Scitex Corp.
-- Israel.
-- 
-- There are two rules for success in life:                   
-- Rule 1:  Don't tell people everything you know.                
-- 


[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID: <Etay_Bogner-2802961057120001@metay.stil.scitex.com>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <4gnush$phg@news.kth.se> <4gognf$et@news.bridge.net> <4gsa2r$gjm@sdaw04.seinf.abb.se> <Etay_Bogner-2702961023450001@metay.stil.scitex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: Etay_Bogner@mail.stil.scitex.com (Etay Bogner)
Newsgroups: comp.std.c++
Subject: Re: Calling X(int) from X()'s init list
Date: 28 Feb 1996 16:16:46 GMT
Organization: Scitex Corp.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <Etay_Bogner-2802961057120001@metay.stil.scitex.com>
References: <4gnush$phg@news.kth.se> <4gognf$et@news.bridge.net> <4gsa2r$gjm@sdaw04.seinf.abb.se> <Etay_Bogner-2702961023450001@metay.stil.scitex.com>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: metay.scitex.com
Content-Length: 1220
X-Lines: 43
Originator: clamage@taumet