-
clear method
I have a Class called CSIString, but in that class there is no method to clear a string. I want to write my own method, and I'm thinking I should just be able to do something like:
str = "";
but that doesn't work. Any of you C++ folk out there have my answer??? Thanks in advance
-
It depends on the internal structure of the class. Since a properly designed class should hide that from you, it depends on what operations the interface allows you to perform. Can you give us some more information? Here's a short list of info that would help us:
1) The class declaration
2) Is it your class?
3) Can you make any changes?
-
1)Since you don't give any information about the data members of your class or the constructors, how would you expect anybody to help you?
2)Why would you ever need to "clear" a string?
3)If you can construct a string from your class that is "aaaaa", then you can construct a string that is all spaces.
3)If you can't fill a string with blanks or \0's you need to study some beginning C++ tutorials on arrays.