Re: Re: New Book: The School of Niklaus Wirth

"Jean Pariseau" <jparis11@home.com>
7 Nov 2000 13:07:21 -0500

          From comp.compilers

Related articles
New Book: The School of Niklaus Wirth webmaster@mkp.com (2000-10-31)
Re: New Book: The School of Niklaus Wirth smoleski@surakware.com (Sebastian Moleski) (2000-11-01)
Re: Re: New Book: The School of Niklaus Wirth mikael@pobox.com (Mikael Lyngvig) (2000-11-04)
Re: Re: New Book: The School of Niklaus Wirth michael.finney@acm.org (Michael Lee Finney) (2000-11-05)
Re: Re: New Book: The School of Niklaus Wirth ollanes@pobox.com (Orlando Llanes) (2000-11-05)
Re: Re: New Book: The School of Niklaus Wirth jsvendsen@bergen.frisurf.no (2000-11-07)
Re: Re: New Book: The School of Niklaus Wirth jparis11@home.com (Jean Pariseau) (2000-11-07)
Re: Compiler issues... (was Re: New Book: The School of Niklaus Wirth) ollanes@pobox.com (Orlando Llanes) (2000-11-09)
Language issues (was: Compiler issues) joachim_d@gmx.de (Joachim Durchholz) (2000-11-11)
Re: Re: New Book: The School of Niklaus Wirth david.thompson1@worldnet.att.net (David Thompson) (2000-11-11)
| List of all articles for this month |
From: "Jean Pariseau" <jparis11@home.com>
Newsgroups: comp.compilers
Date: 7 Nov 2000 13:07:21 -0500
Organization: @Home Network
References: 00-10-227 00-11-019 00-11-024 00-11-046
Keywords: design, OOP

"Orlando Llanes" <ollanes@pobox.com> wrote in message
> I also have to disagree here. C++ has its quirks, but when
> comparing C++ to OO Pascal, one of my pet peeves is that Pascal does
> not call its constructor or destructor automatically (it's incredibly
> annoying that your virtual functions cause a program crash because
> they were not initialized). Also, why on Earth would anyone want
> multiple constructors or multiple destructors? Generally speaking,
> Pascal is strict on type checking which does not allow for
> overloading. One more Pascal pet peeve, why is there no unsigned
> integer (one of my biggest pet peeves)?
>


Why would anyone want multiple constructors? I would think that there are
plenty of reasons.
I know that I use them repeatedly. Multiple constructors are ways of
specifying classes for certain situations,
especially if the language doesn't support somethin like c++'s template
facility. Let's say that I create a class to read disc files
and memory-mapped files. With multiple constructors, I have the option of
something like as follows:
(c++ notation)
        char* filename = file1.txt;
        CFileReader* reader = new CFileReader(filename); //this would create
and instance the reader for files.
        reader->Read();


        CMemoryMappedFile* memfile = new CMemoryMappedFile;
        CFileReader *memreader = new CFileReader(memfile); // create instance
of reader for memorymapped files
        memreader->Read();


This is code reuse. I used the same class for performing the same function
on varying types of data, and the best part is,
I only need to learn one interface. Overloading is a wonderful feature and
I would be hard pressed to use a language that
doesn't support.


Jean


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.