Second argument to operator=
From: exits funnel (exitsfunnel_at_NOSPAMyahoo.com)
Date: 11/30/03
- Next message: Jon Cosby: "hash_map"
- Previous message: Frederick Reeve: "Re: X11 & mouse emuloation"
- Next in thread: Victor Bazarov: "Re: Second argument to operator="
- Reply: Victor Bazarov: "Re: Second argument to operator="
- Reply: Julián Albo: "Re: Second argument to operator="
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Nov 2003 16:53:24 GMT
Hello,
I'm working my way through 'Thinking in C++' by Bruce Eckel. One of the
exercises and the end of chapter 12 is the following:
> Create a class with an assignment operator that has a second argument,
> a string that has a default value that says "op-call." Create a function
> that assigns an object of your class to another one and show that your
> assignment operator is called correctly.
When I try to compile the code I've written for this exercise my
compiler complains:
foo::operator= (const foo &, basic_string<char,string_char_traits<char>,
__default_alloc_template<true, 0> >) must take exactly one argument.
This seems to contradict the intent of the excercise. I've poked around
the net (including the FAQ for this group) to find clarification on the
issue but havn't found any. So what gives? Is my compiler wrong or is
Exckel's exercise broken? Thanks in advance.
-exits
- Next message: Jon Cosby: "hash_map"
- Previous message: Frederick Reeve: "Re: X11 & mouse emuloation"
- Next in thread: Victor Bazarov: "Re: Second argument to operator="
- Reply: Victor Bazarov: "Re: Second argument to operator="
- Reply: Julián Albo: "Re: Second argument to operator="
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|