Xref: utzoo comp.object:2425 comp.lang.pascal:5220 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!resam!andrew From: andrew@resam.dk (Leif Andrew Rump) Newsgroups: comp.object,comp.lang.pascal Subject: Shouldn't debuggers be able to debug dynamic objects? Message-ID: <1991Jan24.152256.24273@resam.dk> Date: 24 Jan 91 15:22:56 GMT Distribution: comp Organization: RESAM Project Office, SAS, CPHML-V Lines: 76 I experienced a rather annoying feature in TurboPascal 5.5 (but I think the problem may exist in a lot of other (integrated) debuggers used to debug object oriented programmes. The program enclosed create two (2) dynamic objects: a square & a box. The first thing to notice is that the compiler only allow squareptr to be used as a general object for squares & boxes! Well I could accept that _IF_ the debugger (integrated & external (TD)) at least would notice when I create a box! But no - it only display the content of a square - the length has to be extracted manually!!! program dynamic; type generalptr = ^general; general = object destructor done; virtual; end; squareptr = ^square; square = object(general) height, width : real; constructor init(h, w : real); end; boxptr = ^box; box = object(square) length : real; constructor init(h, w, l : real); end; destructor general.done; begin end; (* everything is done behind our back *) constructor square.init(h, w : real); begin height := h; width := w; end; constructor box.init(h, w, l : real); begin square.init(h, w); length := l; end; const n = 2; var general_object : array(.1..n.) of squareptr; nr : integer; begin for nr := 1 to n do if odd(nr) then general_object(.nr.) := new(squareptr, init(3, 4)) else general_object(.nr.) := new(boxptr, init(3, 4, 2)); for nr := 1 to n do dispose(general_object(.nr.), done); end. Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark UUCP: andrew@ambra.dk, phone: +45 39 27 11 77 / Currently at Scandinavian Airline Systems =======/ UUCP: andrew@resam.dk, phone: +45 32 32 51 54 \ SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark > > Read oe as: o / (slash) and OE as O / (slash) < <