Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!iuvax!bsu-cs!bsu-ucs!earlham!jeffb From: jeffb@yang.earlham.edu (Jeff Braun) Newsgroups: comp.lang.pascal Subject: HELP WITH TURBO PASCAL 5.5 OOP!!! Please! Message-ID: <2994@yang.earlham.edu> Date: 14 Oct 90 22:32:12 GMT Organization: Earlham College, Richmond, Indiana Lines: 40 Hello, I'm very new to Turbo Pascal 5.5 and as well to Object-Oriented programming in general and I have a few questions if anyone could help me: 1. What is the purpose of using the reserved word CONSTRUCTOR? I understand that every "...object that has virtual methods must have a constructor" (Turbo Pascal: Object-Oriented Programming Guide, page 26) but I don't seem to understand what it is telling the compiler? I sort-of understand that it's used for intialization of a object with virtual methods (right?), but what does it initialize and can they be used for anything other than intialization? So if I have an this piece of code taken from page 42 of TP:OOPG: Location = object X,Y : integer; procedure Init(Initx, Inity :intger); function Getx: integer; function Gety: integer; end; PointPtr = ^Point; Point = object(Location) Visible : boolean; constructor Init(Initx, Inity : integer); procedure Show virtual; procedure Hide virtual; end; Is it used in constructing the X and Y variables in Point or is it allowing for PointPtr to be Initialized at run time as an object pointer? 2. What about DESTRUCTORS? Are they like DISPOSE in Turbo Pascal? I realize these are very simple questions, but I'm just a little (maybe a little more than a little) confused. Thanks. Jeffb@yang.earlham.edu