Topic: std::string as base class
Author: Johann Klugsberger <klugsber@austria.ds.philips.com>
Date: 1997/12/17 Raw View
Szenario:
Compiler is MSVC 5.0
#include <string>
class mystring : public std::string
{
mystring(const char* initVal)
: std::string(initVal)
{
}
};
Compiler issues an error: "illegal member initialization: 'string' is
not a base or member"
OK, I use namespace std:
#include <string>
using namespace std;
class mystring : public string
{
mystring(const char* initVal)
: string(initVal)
{
}
};
everything is OK now? What's the difference, what am I missing here?
TiA, Hans
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]