chipperMDW
Programmer
I can't tell why VC++ doesn't like this code:
[tt]#include <string>
class Foo : public std::string
{
public:
Foo()
: string()
{}
};
[/tt]
VC++ seems to think that string is not a base or member of Foo. Putting "std::" before "string" in the initializer list produces the same error. However, putting "using std::string;" before the class declaration causes it to work fine. The code also works fine with any arbitrary classes and namespaces (say blah::Bar in place of std::string).
Is this a VC++ quirk, or am I using incorrect syntax? In the case of the latter, what would the correct syntax be (without using "using"
?
[tt]#include <string>
class Foo : public std::string
{
public:
Foo()
: string()
{}
};
[/tt]
VC++ seems to think that string is not a base or member of Foo. Putting "std::" before "string" in the initializer list produces the same error. However, putting "using std::string;" before the class declaration causes it to work fine. The code also works fine with any arbitrary classes and namespaces (say blah::Bar in place of std::string).
Is this a VC++ quirk, or am I using incorrect syntax? In the case of the latter, what would the correct syntax be (without using "using"