error: expected initializer before '&' token

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andrew browning

    #16
    Re: error: expected initializer before '&' token

    your right. now can you explain where my logic fell down?????

    Comment

    • Artie Gold

      #17
      Re: error: expected initializer before '&' token

      andrew browning wrote:[color=blue]
      > andrew browning wrote:
      >[color=green]
      >> perhaps this will simplify. below is the header and then the
      >> implementation[/color]
      >
      > [snip]
      >[color=green]
      >>
      >> friend ostream & operator <<(ostream & outs, const BigInt&
      >> big_int1){[/color]
      >
      >
      > ITYM:
      >
      > std::ostream & operator <<(std::ostre am & outs,
      > const BigInt& big_int1) {
      >[color=green]
      >>
      >> outs << big_int1.get_b1 () << " " << big_int1.get_b2 ();
      >>
      >>
      >> return outs;
      >>
      >>
      >> }
      >>
      >>
      >> friend istream & operator >>(istream & ins, const BigInt&
      >> big_int1){[/color]
      >
      >
      > ITYM:
      > std::istream & operator >>(std::istre am & ins,
      > const BitInt& big_int1) {
      >[color=green]
      >>
      >> ins >> target.big_int1 >> target.big_int2 ;
      >>
      >>
      >> return ins;
      >>
      >>
      >> }
      >>
      >>
      >>
      >>
      >>
      >> }
      >>[/color][/color]
      [color=blue]
      > your right. now can you explain where my logic fell down?????
      >[/color]
      Please quote the appropriate amount of context. Fixed.

      Elsethread, you seemed to think that you *could* use ostream and istream
      without the `std::' in front of them -- but didn't know why. The answer
      is that you couldn't, and can't (the error message *is* a confusing one).

      The fact that `friend' is part of a class declaration, and not part of a
      function signature was also pointed out elsethread.

      HTH,
      --ag

      --
      Artie Gold -- Austin, Texas
      I will (ir)regularly write about things that are important to me -- that I hope interest you. Of course, since I see most things as being political, that will be most of it.

      "You can't KISS* unless you MISS**"
      [*-Keep it simple, stupid. **-Make it simple, stupid.]

      Comment

      Working...