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
                void SetValue(const int &a);
                int & GetValue();
                int deger;

Serdar.cc file:

#include "Serdar.hh"
void Serdar::SetValue(const int &a)
        deger = a;
int & Serdar::GetValue()
        return & this.deger;
Member Avatar for iamthwee

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.