home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!ux1.cso.uiuc.edu!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: Friend ..Overload Assignment opertr ..
- Message-ID: <C19838.JM3@cs.uiuc.edu>
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <1993Jan22.075317.21062@usl.edu>
- Date: Fri, 22 Jan 1993 12:01:56 GMT
- Lines: 38
-
- In <1993Jan22.075317.21062@usl.edu> rks9954@usl.edu (Srinivasa Rao K) writes:
-
-
- >
-
-
- > Hi C++ masters,
-
- > I have small question ...
-
- > I am writing a "string" class which i should be able
- > to use like
-
-
- > string str1;
-
- > str1 = "Hello world" ;
-
-
-
- > But We canot use a friend to overload the assignment oprator.
-
- > So finally I had to convince myself to use something like
-
-
- > str1 <= "Hello world"
-
-
- > which works.
-
- > Is there any way to do the first method ....
-
- No. operator=() must be a member. Period. Everybody defines it
- this way and has no problem. Whats wrong with it being a member?
- --
- - Paul J. Lucas
- AT&T Bell Laboratories
- Naperville, IL
-