>
> Yang anda mau, semacam overloading ya? Ya kalo Pascalnya sendiri bukan
> object oriented, nggak bisa dong. Kalo builtin procedure kayak writeln itu
> emang udah khusus dari sananya, programer nggak bisa bikin hal yang sama
> kalo compilernya nggak dukung OO.

Object-Oriented Software Construction 2nd edition, B. Meyer, pg 93:

Syntactic overloading
Overloading is the ability to attach more than one meaning to a name appearing in a
program. The most common source of overloading is for variable names: in almost all
languages, different variables may have the same name if they belong to different
modules (or, in the Algol style of languages, different blocks within a module).
More relevant to this discussion is routine overloading, also known as operator
overloading, which allows several routines to share the same name. This possibility is
almost always available for arithmetic operators (hence the second name): the same
notation, a + b, denotes various forms of addition depending on the types of a and b
(integer, single-precision real, double-precision real). But most languages do not
treat an operation such as "+" as a routine, and reserve it for predefined basic
types -
integer, real and the like. Starting with Algol 68, which allowed overloading the
basic operators, several languages have extended the overloading facility beyond
language built-ins to user-defined operations and ordinary routines.
In Ada, for example, a package may contain several routines with the same name, as
long as the signatures of these routines are different, where the signature of a
routine is defined here by the number and types of its arguments. (The general notion
of
signature also includes the type of the results, if any, but Ada resolves overloading
on the
basis of the arguments only.) For example, a package could contain several square
functions:
square (x: INTEGER): INTEGER is do � end
square (x: REAL): REAL is do � end
square (x: DOUBLE): DOUBLE is do � end
square (x: COMPLEX): COMPLEX is do � end
Then, in a particular call of the form square (y), the type of y will determine which
version of the routine you mean.

---
kayanya operator overloading gak musti OO tuh..

xq.



--
Compu-Mania MailingList, provided by PT Centrin Utama
Unsubscribe: [EMAIL PROTECTED], body: unsubscribe Compu-Mania
Archive: http://www.mail-archive.com/[email protected]/
Info: [EMAIL PROTECTED], body: help

Kirim email ke