maxc0186@sdsu (04/14/89)
Microsoft plans to release QuickPascal for under $100 and will be compatible with Turbo Pascal. It's based on Apple Computer's Object Pascal. Does anyone know what object-oriented features were added to Object Pascal? ------------------------------------------------------------------- It's only a job, not an adventure!
lsr@Apple.COM (Larry Rosenstein) (04/22/89)
In article <3688@sdsu.UUCP> ucselx!maxc0186@sdsu writes: > Object Pascal. Does anyone know what object-oriented features were > added to Object Pascal? Object Pascal adds the minimum features to Pascal to support object-oriented programming. This means it doesn't have all features that C++ has vs. C, for example. Specifically, you can define classes as new types, for example: type Rectangle = Object(Shape) bounds: Rect; Procedure Rectangle.Draw; Override; Procedure Rectangle.SetBounds(newBounds: Rect); Function GetBounds: Rect; end; Here, Rectangle is a subclass of Shape. (Object Pascal supports only single inheritance.) It adds one field and two methods to those defined in Shape and Shape's ancestors. It also overrides the Draw method of Shape. Objects are intended to be similar to Records, and you use the same syntax to access fields & methods of objects (e.g., aShape.Draw, aShape.bounds, etc.). Objects are created using the New builtin function, for example: var aShape: Shape; New(aShape); In Object Pascal there are no class objects or metaclasses. There is also no privacy of fields or methods, which means any piece of code can get or set any field of any object. (This is similar to Records.) Compared to C++, all object instances are references (i.e., you cannot put an object on the stack). On the Macintosh, an object is a handle (a doubly-indirected pointer), but other implementations could make objects simple pointers. There are no contructors or destructors. All methods are virtual (in the C++ terminology). (Apple's implementation of Object Pascal, however, does an automatic optimization to remove the method dispatching overhead in certain cases.) If you have other questions, let me know. Larry Rosenstein, Apple Computer, Inc. Object Specialist Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1