delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/08/16:01:18

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Return Types for Constructors
Date: 8 Dec 1997 09:02:50 GMT
Organization: The National Capital FreeNet
Message-ID: <66gd3q$7d@freenet-news.carleton.ca>
References: <01bd0366$cfe6d140$d744e4cf AT cadvision DOT com>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet5.carleton.ca
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp



This is odd. I always write constructurs like so:


class foo {
  int bar;
  double baz;

  foo (void) { bar=5; baz=18.669; }
  inline foo (int x);
}



foo::foo(int x) {
  bar=x;
  baz=double(x)+0.5;
}

and never have any problems. The dox on writing C++ I've read all seem to
indicate you just don't specify any return type on constructors at all,
and let the compiler take care of it, and the same for destructors.
--
    .*.  Friendship, companionship, love, and having fun are the reasons for
 -()  <  life. All else; sex, money, fame, etc.; are just to get/express these.
    `*'  Send any and all mail with attachments to the hotmail address please.
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca pgd73 AT hotmail DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019