473,395 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Type conversion compiler errors

I try to compile the the program return me 5 errors.

The errors is as below:
Error 1 error C2440: '=' : cannot convert from 'char *' to 'char' d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 36
Error 2 error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 37
Error 3 error C2511: 'A &A::operator =(const char *)' : overloaded member function not found in 'A' d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 41
Error 4 error C2541: 'delete' : cannot delete objects that are not pointers d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 53
Error 5 error C2440: '=' : cannot convert from 'char *' to 'char' d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 57
Error 6 error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 58

Thanks for your help.

I also don't understand the assignment operator with pointer.
Aug 28 '07 #1
5 2266
weaknessforcats
9,208 Expert Mod 8TB
Error 1 error C2440: '=' : cannot convert from 'char *' to 'char' d:\c++\assignment_operator\assignment_operator\ass ignment_operator.cpp 36
Look at the code on line 36 of ass ignment_operator.cpp.

It appears the assignment operator needs a char on the right and you have suppliced a char*. Maybe you are missing a dereference operator.

Your other errors are of the same sort. Either a char is needed and a char* was supplied or a char* was needed and a char was supplied.

It may be yoiu are just confused about the difference between a variable and its address.
Aug 28 '07 #2
Thanks. Solved the problem.
Aug 30 '07 #3
What is the explicit call of second = first ?

Thanks for your help.
Aug 30 '07 #4
I need your help. What is the explicit call of

A first, second;

second = first;

Moreover, since we delete the this pointer, how we can copied to another object ?

Thanks for your help and explanation.
Sep 11 '07 #5
Banfa
9,065 Expert Mod 8TB
Firstly you should not be hikjacking someone elses thread to ask you questions. In future create a thread of your own, I have now split your question into a separate thread.


Secondly i am afraid that the question you have asked involving first and second does not make sense to me. You will have to explain what you mean in more detail.
Sep 11 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Terje Slettebø | last post by:
Hi. I'm new here, and sorry if this has been discussed before; I didn't find it searching the PHP groups. (I've also read recommendations to cross-post to the other PHP groups, but if that is...
21
by: Nitin Bhardwaj | last post by:
Hi all, It is said that C++ is a strongly typed language and thus a type-safe language (unlike C). So how does one explain the following behaviour : int main(void) { char *p = NULL; p = "A...
3
by: Steve Richter | last post by:
here is a warning I am getting in a C++ .NET compile: c:\SrNet\jury\JuryTest.cpp(55) : warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied while...
16
by: Abhishek | last post by:
why do I see that in most C programs, pointers in functions are accepted as: int func(int i,(void *)p) where p is a pointer or an address which is passed from the place where it is called. what...
2
by: Martin v. Löwis | last post by:
I've been working on PEP 353 for some time now. Please comment, in particular if you are using 64-bit systems. Regards, Martin PEP: 353 Title: Using ssize_t as the index type Version:...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
16
by: Martin Jørgensen | last post by:
Hi, Short question: Any particular reason for why I'm getting a warning here: (cast from function call of type int to non-matching type double) xdouble = (double)rand()/(double)RAND_MAX;
13
by: Michal Nazarewicz | last post by:
The following code compiles fine (with warnings though) under GCC with -pedantic and -ansi arguments: #v+ int main(void) { const int a = 0; int *p = &a; return 0; } #v-
4
by: zaeminkr | last post by:
I got a good answer here I have still confusing part. I have two very simple classes class DRect { private : double x0, y0, x1, y1; public : DRect(double a, double b, double c, double d) :...
15
by: aman | last post by:
is it true that c compiler automatically picks a variable as an integer if we can't explicitly declare it at beginning of a program????
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.