Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Conversion

Posted on 2006-06-27
1
Medium Priority
?
177 Views
Last Modified: 2010-04-24
I have class StringWrapper
void StringWrapper::      operator=      (System::String^ Value)
{
    MyString = Value;      
}

Following code:
------------------

StringWrapper a;
a="a";                      // Works well

StringWrapper^ b;
b = "b";                   // does not compile


What I nned to do to get rid of error:
error C2440: '=' : cannot convert from 'const char [2]' to 'StringWrapper ^'
0
Comment
Question by:PLABB
1 Comment
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 total points
ID: 16991188
   StringWrapper^ b = gcnew StringWrapper();
    *b = "b";

Your code is not compiled because you try to assign string to reference and not to class instance.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question