A
aryan
Hello,
The following code throws "undefined reference to `Buster::Buster()'"
unless I remove inline keyword. Could someone please explain why?
//************************
// In file buster.h
//************************
class Buster {
private:
static int instanceCount;
public:
Buster();
virtual
~Buster();
static
int
getInstanceCount();
};
//**************************
//In file buster.cpp
//**************************
int
Buster::instanceCount = 0;
inline
Buster::Buster() {
instanceCount++;
}
int
Buster::getInstanceCount() {
return instanceCount;
}
inline
Buster::~Buster() {
instanceCount--;
}
///////////////////////////////////////
Thanks.
The following code throws "undefined reference to `Buster::Buster()'"
unless I remove inline keyword. Could someone please explain why?
//************************
// In file buster.h
//************************
class Buster {
private:
static int instanceCount;
public:
Buster();
virtual
~Buster();
static
int
getInstanceCount();
};
//**************************
//In file buster.cpp
//**************************
int
Buster::instanceCount = 0;
inline
Buster::Buster() {
instanceCount++;
}
int
Buster::getInstanceCount() {
return instanceCount;
}
inline
Buster::~Buster() {
instanceCount--;
}
///////////////////////////////////////
Thanks.