I zdefiniowano funkcję jako statyczne w mojej klasie w ten sposób (fragment odpowiedniego kodu)statyczna funkcja: klasa przechowywania nie może być określona tutaj
#ifndef connectivityClass_H
#define connectivityClass_H
class neighborAtt
{
public:
neighborAtt(); //default constructor
neighborAtt(int, int, int);
~neighborAtt(); //destructor
static std::string intToStr(int number);
private:
int neighborID;
int attribute1;
int attribute2;
#endif
iw pliku .cpp jak
#include "stdafx.h"
#include "connectivityClass.h"
static std::string neighborAtt::intToStr(int number)
{
std::stringstream ss; //create a stringstream
ss << number; //add number to the stream
return ss.str(); //return a string with the contents of the stream
}
i pojawia się błąd (VS C++ 2010) w pliku .cpp z informacją "Klasa pamięci nie została tu określona" i nie mogę określić, co robię źle.
p.s. Czytałem już this, który wygląda jak duplikat, ale nie wiem - tak jak on - że mam rację i kompilator jest wybredny. Każda pomoc jest doceniana, nie mogę znaleźć żadnych informacji na ten temat!
Czy jesteś pewien "zmienności"? Pojawia się jako * specyfikator klasy pamięci * w BNF, ale nie zachowuje się jak jeden. Oraz 'thread_local' jest specyfikatorem klasy pamięci w C++ 11. –
@BenVoigt: Tak, C++ 03 §7.7.1 zawiera listę tych 5 specyfikatorów. –