Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!oddjob!gargoyle!ihnp4!homxb!mhuxt!mhuxm!mhuxo!ulysses!allegra!alice!ark From: ark@alice.UUCP Newsgroups: comp.lang.c++ Subject: Re: dumb question, probably Message-ID: <7164@alice.UUCP> Date: Fri, 7-Aug-87 13:03:13 EDT Article-I.D.: alice.7164 Posted: Fri Aug 7 13:03:13 1987 Date-Received: Sun, 9-Aug-87 08:42:56 EDT References: <10120@orchid.waterloo.edu> Distribution: comp Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 38 In article <10120@orchid.waterloo.edu>, gamiddleton@orchid.UUCP writes: > As far as I can tell, the following fragment should be (syntactically) > correct: > > class zot { > int *x; > public: > zot( zot & ); > ~zot() { delete x; } > }; > > void zot::zot( zot &z ) { > x = new (int); > *x = *z.x; > } A constructor never returns a value, so one does not ever declare the type of its value. Thus one says class foo { public: foo(); }; and not class foo { public: void foo(); }; Similarly, one just writes foo::foo() { } and not void foo::foo() { }