Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!hplabs!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM ( Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: elementary question about c++ Message-ID: <6590034@hplsla.HP.COM> Date: 12 Apr 88 23:53:54 GMT References: <1297@tekirl.TEK.COM> Organization: HP Lake Stevens, WA Lines: 25 /* Actually, this might be an interesting example. The following program is about the same, except constructors and destructors make and destroy a value, and I'm using old i/o in order to make for easier decyphering of the resulting ..c intermediate file. The Million Dollar Question: what SHOULD the printf statement in main() print out ??? Explain your answer :-) */ #include class foo { public: long value; foo () { printf("cons\n"); value = 1000000;} ~foo () { printf("dest\n"); value = 0;} }; foo bar() { foo a; return a; } main () { foo c = bar (); printf("c.value = %d\n",c.value); }