From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: C++ in Mail Archive Date: Mon, 07 Sep 1998 18:49:38 -0300 Organization: NBTel Internet Lines: 36 Message-ID: <35F454F2.1628D7C0@unb.ca> References: <3 DOT 0 DOT 1 DOT 16 DOT 19980906135107 DOT 094fdb70 AT shadow DOT net> <3 DOT 0 DOT 1 DOT 16 DOT 19980907121517 DOT 1987d5b0 AT shadow DOT net> NNTP-Posting-Host: fctnts05c61.nbnet.nb.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ralph Proctor wrote: > >Overloading is also a major function, with the > >iostream being the prime example of this. > This I don't understand. Here is an example of function overloading: void Print(int a); void Print(float a); void Print(char* a); //In C you would have to use different names: void PrintInt(int a); void PrintFloat(float a); void PrintString(char* a); // Or void Print(char* format, ...); // But that is slightly annoying to program. You can also do the same thing with operators: struct Complex {int real,fake;} Complex operator + (Complex a, Complex b); //This function will be called anytime you do something like this: Complex A,B,C; A = B+C; //Called here. -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT GeoCities DOT com Endlis AT nbnet DOT nb DOT ca