Problems with constructor return types

Tony Lawrie (freenet) tonl@freenet.co.uk
Sat Oct 11 17:31:00 GMT 2003


Hi,

I'm trying to create a class using gcc in c++ (i.e, g++). But the
compiler keeps complaining:

a) ISO C++ forbids defining types within return type
b) return type specification for constructor invalid

My class attributes in the header file (i.e. .h) are:

float  i;
bool j;
int k;
float l;

...and are declared private. 

I declare the constructor as the same class name in the public section
of the header file, as follows:

public:

class_name();

In the implementation file ( i.e. .cpp) i #include the class header and
define the initialize constructor as follows:

class_name::class_name(void): i(0.00), j(false), k(0), l(0.00)
{
}


...what am i missing or doing wrong Guys? 


Cheers --- Tony. 





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20031011/f58ffb2a/attachment.sig>


More information about the Gcc-help mailing list