S
Seb
Is this efficient for a header file and a class? Does a 'static local'
variable get created for each instance or include of the header file? Also,
'return _type().ToString();' does not seem to work.
The error states:
Object.h(16): error C2662: 'DataLib::Object::_type' : cannot convert 'this'
pointer from 'const DataLib::Object' to 'DataLib::Object &'
namespace DataLib
{
class Object
{
public:
virtual inline const char* ToString() const { return
_type().ToString(); }
virtual inline const DataType &GetType() { return _type(); }
protected:
virtual const DataType& _type()
{
static DataType type("Object","Object",0);
return type;
}
};
}
variable get created for each instance or include of the header file? Also,
'return _type().ToString();' does not seem to work.
The error states:
Object.h(16): error C2662: 'DataLib::Object::_type' : cannot convert 'this'
pointer from 'const DataLib::Object' to 'DataLib::Object &'
namespace DataLib
{
class Object
{
public:
virtual inline const char* ToString() const { return
_type().ToString(); }
virtual inline const DataType &GetType() { return _type(); }
protected:
virtual const DataType& _type()
{
static DataType type("Object","Object",0);
return type;
}
};
}