From: Vik Heyndrickx Newsgroups: comp.os.msdos.djgpp Subject: Re: Return Types for Constructors Date: Mon, 08 Dec 1997 08:46:26 +0100 Organization: University of Ghent, Belgium Lines: 25 Message-ID: <348BA5D2.503C@rug.ac.be> References: <01bd0366$cfe6d140$d744e4cf AT cadvision DOT com> NNTP-Posting-Host: eduserv1.rug.ac.be Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Robert Lazorko wrote: > > I am writing code which implements classes for C++, and yet, the compiler > gives the error message "return type specified for constructor invalid"... > > Vector::Vector() > { > x = 0; > y = 0; > } constructors always return void, so you should have written instead: void Vector::Vector () IIRC the compiler assumes 'int' for the return type if you omit it in C++. BTW since this question is not DJGPP specific you should have posted this to comp.lang.c++. -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/