Problems with constructor return types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux