Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!Apple.COM!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.lang.pascal Subject: Re: experience with tp5.5? Message-ID: <2971@internal.Apple.COM> Date: 21 Jul 89 21:00:30 GMT Sender: usenet@Apple.COM Organization: Objects-R-Us, Apple Computer, Inc. Lines: 32 References:<799@eutrc3.urc.tue.nl> <390004@hpctdls.HP.COM> In article <390004@hpctdls.HP.COM> wei@hpctdls.HP.COM (Bill Ives) writes: > The constructor and destructor methods must be called when the object > contains virtual methods or unpredicable result may occur. Even if the > object is statically allocated and is then assigned to another object This is pretty bad, in my opinion. If you are going to define the concept of constructors and destructors, you should also have them called automatically. This is one of the nice features of C++, and it is unfortunate that Borland didn't recognize it as a good feature. In C++ you can be sure that the internal state of an object is always consistent, because the constructor would have been called. > mine := ^myptr ; { assign dynamic var to the static var } > mine.Init(2) ; { initialize the static var } The fact that you have to call the constructor after an assignment is a very serious deficiency. It makes it more difficult to deal with objects than with other types. Presumably, you wanted to make a copy of the object in this case, so how do you know what to pass to the constructor? This is changing the meaning to assignment as applied to objects. (A question. What if you pass an object as a parameter. Does the called routine have to call its constructor?) Larry Rosenstein, Apple Computer, Inc. Object Specialist Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1