home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.pascal:6685 comp.object:4257
- Newsgroups: comp.lang.pascal,comp.object
- Path: sparky!uunet!clarkson!news
- From: kooijman@sun.soe.clarkson.edu (Harry Kooijman,Peyt314a,3808)
- Subject: Re: BP/TP OOP is missing something...
- Message-ID: <1992Nov18.161317.5225@news.clarkson.edu>
- Sender: news@news.clarkson.edu
- Nntp-Posting-Host: sun.soe.clarkson.edu
- Organization: Clarkson University
- References: <dmurdoch.284.722095796@mast.queensu.ca>
- Date: Wed, 18 Nov 1992 16:13:17 GMT
- Lines: 30
-
- From article <dmurdoch.284.722095796@mast.queensu.ca>, by dmurdoch@mast.queensu.ca (Duncan Murdoch):
- > In article <1992Nov18.104536.9985@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
- >
- >>In any flavour of OO Pascal without such parameters, the constructor
- >>of a general matrix class (i.e. without fixed dimensions) would most
- >>naturally create only a "handle" for an actual matrix.
- >
- > This doesn't seem like a very clean solution. Does it mean that I'd have
- > an array without a size after the automatic initialization? Then I'd have
- > to send a size message to it before I could use it? It sounds to me as
- > though the size message is the real initialization; automatic initialization
- > doesn't work here, because it doesn't produce a usable object (i.e.
- > establish the invariants of the class, as you said).
- >
-
- The language does not force you to have an "empty" constructor and that
- the actual initialization (here for the matrix size) is done later, but
- allows you to do both. Now that's freedom of choice! Actually it allows
- classes/objects that size themselves according to the (local) needs. So
- you can say I want a vector, use it for an array of size x, then
- increase its size to y, use it, then decrease its size to z and use it.
- When the vector goes out of scope, it knows what it last size was and
- frees the memory it was occupying at destruction.
-
-
-
- --
- Harry Kooijman: Rigorous dynamic distillation simulation.
- Dept. of Chemical Engineering, Clarkson University, Potsdam NY 13699.
- kooijman@sun.soe.clarkson.edu
-