From: "Bart Kowalski" Newsgroups: comp.lang.c++,comp.os.msdos.djgpp References: <9ag6en$s1t$1 AT tron DOT sci DOT fi> Subject: Re: Array class assignment operator. Confused.... Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Message-ID: Date: Thu, 05 Apr 2001 04:28:40 GMT NNTP-Posting-Host: 64.229.163.173 X-Trace: news20.bellglobal.com 986444920 64.229.163.173 (Thu, 05 Apr 2001 00:28:40 EDT) NNTP-Posting-Date: Thu, 05 Apr 2001 00:28:40 EDT Organization: Sympatico To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > Here is my problem (made a little array class with linked list) > > Array table(8); > Array table2(4); > > table = table2; > > Should the above line assign ("Array& operator=(const Array&)") > as much as possible from the smaller array object to larger one > and keep any left over elements unchanged OR should it > make identical copy of the smaller one and delete any left over > array elements ??? Please don't post attachments to newsgroups. It is considered very rude, and some news servers will delete your message. Now to your question. When you assign an object to another object then both objects should be equivalent after the assignment. The standard container classes such as vector assume this. So you should definitely go with the second option. Bart.