Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13258
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: " *first = new string(*rhs.first);" cannot compile in MSVC |
| Date | 2012-01-12 15:31 +1300 |
| Message-ID | <9n6v0qFvfbU3@mid.individual.net> (permalink) |
| References | <d29fdc08-5a93-47d6-a716-926803e54b36@k28g2000yqc.googlegroups.com> |
On 01/12/12 03:22 PM, fl wrote:
> Hi,
> I am learning C++ with a web download small C++ routine. The member
> function below the dot line cannot compile in MSVC express 2010. The
> error message is:
>
> 1>c:\users\jeff\documents\visual studio 2010\projects\ldpc\person
> \person.cpp(27): error C2679: binary '=' : no operator found which
> takes a right-hand operand of type 'std::string *' (or there is no
> acceptable conversion)
>
> Because the web site is a university C++ course, I guess it should not
> be a totally wrong. I also feel that line 27 usage is really strange.
>
> What is your opinion? Thanks a lot.
>
> ....................
>
> const Person& Person::operator=(const Person& rhs){
> if( this !=&rhs ){
> delete first;
> delete last;
> (line 27): *first = new string(*rhs.first);
> *last = new string(*rhs.last);
> id = rhs.id;
> }
>
> return *this;
> }
The definition of Person would help (what are first and last?).
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
" *first = new string(*rhs.first);" cannot compile in MSVC fl <rxjwg98@gmail.com> - 2012-01-11 18:22 -0800
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Ian Collins <ian-news@hotmail.com> - 2012-01-12 15:31 +1300
Re: " *first = new string(*rhs.first);" cannot compile in MSVC fl <rxjwg98@gmail.com> - 2012-01-11 19:29 -0800
Re: " *first = new string(*rhs.first);" cannot compile in MSVC "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-12 04:42 +0100
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Ian Collins <ian-news@hotmail.com> - 2012-01-12 18:04 +1300
Re: " *first = new string(*rhs.first);" cannot compile in MSVC BCFD36 <bcfd36@cruzio.com> - 2012-01-11 23:07 -0800
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Juha Nieminen <nospam@thanks.invalid> - 2012-01-12 08:12 +0000
Re: " *first = new string(*rhs.first);" cannot compile in MSVC "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-12 09:50 +0100
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 12:36 +0000
Re: " *first = new string(*rhs.first);" cannot compile in MSVC "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-12 14:12 +0100
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Leigh Johnston <leigh@i42.co.uk> - 2012-01-12 13:36 +0000
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Juha Nieminen <nospam@thanks.invalid> - 2012-01-12 14:41 +0000
Re: " *first = new string(*rhs.first);" cannot compile in MSVC drew@furrfu.invalid (Drew Lawson) - 2012-01-12 14:50 +0000
Re: " *first = new string(*rhs.first);" cannot compile in MSVC Goran <goran.pusic@gmail.com> - 2012-01-11 23:12 -0800
csiph-web