www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/16/01:16:34

From: horst DOT kraemer AT gmx DOT de (Horst Kraemer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: constructor question...
Date: Tue, 16 May 2000 04:55:25 GMT
Lines: 35
Message-ID: <3920443b.80579546@news.cis.dfn.de>
References: <20000515060507 DOT 20515 DOT qmail AT web108 DOT yahoomail DOT com>
NNTP-Posting-Host: pc19f6601.dip.t-dialin.net (193.159.102.1)
X-Trace: fu-berlin.de 958452805 126071 193.159.102.1 (16 [27606])
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sun, 14 May 2000 23:05:07 -0700 (PDT), Mohamed Saad
<bazramit AT yahoo DOT com> wrote:

> Hello...
> I have a small question...
> if i have a class called Txyz...
> 
> what does the following code do?
> int main(void)
> {
>    Txyz();
> }
> 
> does this create a nameless instance of the class??

Yes. It creates it and throws it away at the same time. A more
"useful" example would be


#include <iostream.h>

struct X
{
  void hello() { cout << "hello\n"; }
};

int main()
{
   X().hello();
}


Regards
Horst

- Raw text -


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