String Class Operations
-
Is it possible to create a string/char-array class with overloading operations that could preformed these operations?: String = “Hello ” + “World”; Where two constant strings/char-arrays “Hello ” and “World” adds and inserts into the String class. So that the class String will contain the string/char-array "Hello World". Aidman » over and out
-
Is it possible to create a string/char-array class with overloading operations that could preformed these operations?: String = “Hello ” + “World”; Where two constant strings/char-arrays “Hello ” and “World” adds and inserts into the String class. So that the class String will contain the string/char-array "Hello World". Aidman » over and out
You could use CString (now available for both MFC and ATL) Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
You could use CString (now available for both MFC and ATL) Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
Yes I know... but it would be nice to know that this syntax is possible in pure C++ :) Aidman » over and out
Aidman wrote: but it would be nice to know that this syntax is possible in pure C++ Yes, it is very much possible. You just have to overload the + operator and the += operator. In fact taking a look at the CString source might help you. There are also some very good non-MFC CString-type classes here on CodeProject. Regards, Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
Yes I know... but it would be nice to know that this syntax is possible in pure C++ :) Aidman » over and out
What do you mean by "pure C++"? If I get your question, the answer is no, you cannot overload
+
to concatenate twochar
arrays. At least one argument must be a user-defined type. --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me -
What do you mean by "pure C++"? If I get your question, the answer is no, you cannot overload
+
to concatenate twochar
arrays. At least one argument must be a user-defined type. --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to meMichael Dunn wrote: What do you mean by "pure C++"? What I mean is if it possible to create a class with C++ syntax (non-MFC) that could preform exactly the following operation: String = "Hello " + "World"; Michael Dunn wrote: If I get your question, the answer is no, you cannot overload + to concatenate two char arrays. At least one argument must be a user-defined type. But can cString preform this operation? Meaning can cString do this?: String = "Hello " + "World"; If so then why can cString do it and not a custom class? Aidman » over and out
-
Michael Dunn wrote: What do you mean by "pure C++"? What I mean is if it possible to create a class with C++ syntax (non-MFC) that could preform exactly the following operation: String = "Hello " + "World"; Michael Dunn wrote: If I get your question, the answer is no, you cannot overload + to concatenate two char arrays. At least one argument must be a user-defined type. But can cString preform this operation? Meaning can cString do this?: String = "Hello " + "World"; If so then why can cString do it and not a custom class? Aidman » over and out
Aidman wrote: What I mean is if it possible to create a class with C++ syntax (non-MFC) that could preform exactly the following operation: String = "Hello " + "World"; No, read my previous post again for why this is not possible. --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me
-
Aidman wrote: What I mean is if it possible to create a class with C++ syntax (non-MFC) that could preform exactly the following operation: String = "Hello " + "World"; No, read my previous post again for why this is not possible. --Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me
-
Aidman wrote: Ok, but can cString preform this operation? Nope. You can add a CString and a character pointer, but you cannot add two character pointers :-) Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
Aidman wrote: Ok, but can cString preform this operation? Nope. You can add a CString and a character pointer, but you cannot add two character pointers :-) Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]