Second argument to operator=

From: exits funnel (exitsfunnel_at_NOSPAMyahoo.com)
Date: 11/30/03


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



Relevant Pages

  • Re: reducing flash size in embedded processors?
    ... >generated difference from a good compiler. ... The first time I did this as a serious ... The C version of the library was as tight as assembler and would run on ... Had you tried the exercise with a math library different from the C ...
    (comp.arch.embedded)
  • Re: reducing flash size in embedded processors?
    ... >>A much more interesting exercise recoding an assembly routine in C and looking ... >>generated difference from a good compiler. ... The C version of the library was as tight as assembler and would run on ... are the same independently of the language - at the end of the day ...
    (comp.arch.embedded)
  • Re: Second argument to operator=
    ... "exits funnel" wrote... ... >> assignment operator is called correctly. ... > When I try to compile the code I've written for this exercise my ... Is my compiler wrong or is ...
    (comp.lang.cpp)
  • Re: Nasm 0.99.01 available
    ... The current exercise will improve, if anything, his C skills. ... Or a bunch of hacks for this particular compiler, ... Doing this in NASM will end up with one set of source for ...
    (alt.lang.asm)
  • Re: use of do{...}while(0)
    ... >>because the loop executes only once. ... I went through the faq section 10.4 ... > and it will compile (exercise: ...
    (comp.lang.c)