I have written a field class that inherits from the string class, but I need to overload the << and >> operators to handle input/output to a file but I am having trouble with the implementation.
Any help?
I have written a field class that inherits from the string class, but I need to overload the << and >> operators to handle input/output to a file but I am having trouble with the implementation.
Any help?
"In theory, there is no difference between theory and practice. But, in practice, there is."
- Jan L.A. van de Snepscheut
Post what code you do have, and the errors you're getting.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
In addition to posting code, maybe you can reassure us that you've considered the fact that is generally considered a bad idea to use a class that has no virtual destructor (or any other virtual functions) as a base class. In this case, string was not designed to be inherited from through public derivation.
If you have considered this, then okay, good luck.
If not, then maybe you should consider a different solution. Or if you are interested maybe I or someone else here can explain the dangers of doing that in more detail.
Yeah -- deriving from std::string == bad
Perhaps you can create a new typedef with different parameters to std::basic_string, and then overload the functions you need.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.