This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with constructor return types


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. 





Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]