Start New Discussion within our Software Development Community

when i,

g++ -c Serdar.cc

compiler says:

Serdar.cc:3: error: semicolon missing after declaration of `Serdar'
Serdar.cc:4: error: ISO C++ forbids defining types within return type
Serdar.cc:4: error: two or more data types in declaration of `SetValue'
Serdar.cc:4: error: prototype for `Serdar Serdar::SetValue(const int&)' does 
   not match any in class `Serdar'
Serdar.hh:5: error: candidate is: void Serdar::SetValue(const int&)
Serdar.cc:4: error: `Serdar Serdar::SetValue(const int&)' and `void 
   Serdar::SetValue(const int&)' cannot be overloaded
Serdar.cc:4: error: semicolon missing after declaration of `class Serdar'
Serdar.cc: In member function `int& Serdar::GetValue()':
Serdar.cc:10: error: request for member `deger' in `this', which is of 
   non-class type `Serdar* const'

Serdar.hh file:

class Serdar
{
        public:
                void SetValue(const int &a);
                int & GetValue();
        private:
                int deger;
}

Serdar.cc file:

#include "Serdar.hh"
void Serdar::SetValue(const int &a)
{
        deger = a;
}
int & Serdar::GetValue()
{
        return & this.deger;
}

Don't class declarations need a semicolon after 'em?

int & Serdar::GetValue()
That looks odd. Might be ok ain't checked it.

This question has already been answered. Start a new discussion instead.