home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!cs.utexas.edu!torn!watserv1!watdragon.waterloo.edu!watstat.waterloo.edu!dmurdoch
- From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch)
- Subject: Re: Constants in an Object
- Message-ID: <BrqM02.BtG@watdragon.waterloo.edu>
- Sender: news@watdragon.waterloo.edu (USENET News System)
- Reply-To: dmurdoch@mast.queensu.ca
- Organization: University of Waterloo
- References: <1992Jul19.073015.1199@ecst.csuchico.edu> <phfrom.183@nyx.uni-konstanz.de>
- Date: Tue, 21 Jul 1992 11:45:37 GMT
- Lines: 22
-
- In article <phfrom.183@nyx.uni-konstanz.de> phfrom@nyx.uni-konstanz.de (Hartmut Frommert) writes:
- >
- >What I didn't try up to now is
- >
- >const
- > MyObject: TMyObject = (345);
- >
- >or thelike. I assume this failes because no memory is reserved for MyObject;
- >this is done by the constructor call.
-
- You can have object constants, but the value has to be declared like a
- record constant:
-
- const
- MyObject: TMyObject = (Myfield: 345);
-
- The constructor call doesn't allocate memory, it fills in the VMT field.
- The compiler does that for you in a constant object, so no constructor
- call is needed. This is discussed in Chapter 5 of the Programmer's Guide.
-
- Duncan Murdoch
- dmurdoch@mast.queensu.ca
-