I have some pure virtual function in a class, that is defined in header file, like this:
virtual string GetStdString() = 0
{
// some code
}
On windows it works fine, but compiling with XCode I have an error
"Expected ';' at end of declaration list"
that points to the end of line with function name.
Whatever compiler you're using on Windows is wrong on this. That code should not compile. You can provide a body for a pure virtual function, but you cannot do so in the same declaration (pretty much only because the standard says so). Change your code like this:
class TheClass
{
virtual string GetStdString() = 0;
};
inline string TheClass::GetStdString()
{
// some code
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments