Posted by Kspansel@xxx.xxx on 1999-09-05
Hello,
I am having trouble figuring out how to use the operator keyword. Let's
say I have a crappy lil string class:
class CrappyString
{
public:
CrappyString(char *str);
CrappyString();
~CrappyString();
protected:
char *StringData;
}
Let's say the constructor just allocates mem and fills the string. How and
where would I use the operator keyword to define a function that would let me
make my CrappyString = to another string.
CrappyString str;
str = "Hello";
And also how to "add" strings together.. (concatenate sp?) like:
CrappyString str1 = "Hey, ";
CrappyString str2 = "man.";
CrappyString str3 = str1 + str2;
Or even:
CrappyString str = "Hey, " + "man";
Sorry if I'm so unclear if you need me to explain it further then just
ask..thanks for any help at all.
Previous post | Next post | Timeline | Home