Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!emory!ox.com!math.fu-berlin.de!unido!fauern!faui43.informatik.uni-erlangen.de!bdhelm From: bdhelm@immd4.informatik.uni-erlangen.de (Bernd Helm) Newsgroups: comp.lang.pascal Subject: Re: TP6.0 OOP Quiery Message-ID: <1991Jun17.120123.4946@informatik.uni-erlangen.de> Date: 17 Jun 91 12:01:23 GMT References: <1991Jun16.075044.18283@cs.mcgill.ca> <1991Jun17.005251.1184@maytag.waterloo.edu> Organization: CSD., University of Erlangen, Germany Lines: 38 dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes: >In article <1991Jun16.075044.18283@cs.mcgill.ca> storm@cs.mcgill.ca (Marc WANDSCHNEIDER) writes: >> >>In the TP 6.0 Users manual, they start building up OOPs with objects typed >>Location and Point. >... >> >>MY problem is: Why have they declared an INIT procedure for type Point, when >>Location already has this procedure declared. If objects have inheritance, >>then there should already be an INIT procedure built into the Point type. >In the example you gave, you are correct: though declared as >constructors, the two Init routines are just procedures. However, in more I think, you missed the point: Point.Init is needed to initalize correctly the Visible-variable in Point where Location.Init doesn't know anything about Visible: >> Point = object(Location) >> Visible: Boolean; ^^^^^^^^ >> procedure Init(InitX, InitY: integer); I would implement Point.Init so: procedure Point.Init(InitX, InitY: integer); begin Location.Init(InitX, InitY); Visible := FALSE; { do what is needed to show the point... } end; bye,bye Bernd