-
July 9th, 2021, 01:12 AM
#1
How to fix Compile Wrong datatype on vs2019?
Hi,
I have created 4 methods as follows:
Code:
void Range::WriteValue(CStringW value)
{
}
void Range::WriteValue(int value)
{
}
void Range::WriteValue(double value)
{
}
void Range::WriteValue(bool value)
{
}
then, I called it by this code :
Code:
Range(L"A1").WriteValue(L"hello world");
but it seem not compiled param L"hello world" as CString but bool,
Is there a way for the compiler to understand I'm using a CString without having to specifically like this:
Code:
Range(L"A1").WriteValue(CString(L"hello world"));
Thanks you!
Last edited by Dang.D.Khanh; July 9th, 2021 at 01:15 AM.
-
July 9th, 2021, 01:29 AM
#2
Re: How to fix Compile Wrong datatype on vs2019?
Why don't you want to add the overloaded:
Code:
void Range::WriteValue(LPCWSTR value)
Victor Nijegorodov
-
July 9th, 2021, 01:57 AM
#3
Re: How to fix Compile Wrong datatype on vs2019?
Hi Sir,
Now it worked.
I'm quite unfamiliar with LPC*** type, because I usually just use CString and const wchar_t* .
Are these two datatypes similar?
-
July 9th, 2021, 02:43 AM
#4
Re: How to fix Compile Wrong datatype on vs2019?
Victor Nijegorodov
-
July 9th, 2021, 03:05 AM
#5
Re: How to fix Compile Wrong datatype on vs2019?
Originally Posted by VictorN
Thanks Sir ,
I will definitely use them more.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|