$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
One Stop Computer Science
21 Dec // php the_time('Y') ?>
Setiap subprogram memiliki single entry point. Sebuah program yang dipanggil saat eksekusi disebut subprogram.
Local Variable
Keuntungan:
Kerugian:
Parameter Passing Methods
Nilai dari actual parameter digunakan untuk inisialisasi corresponding formal parameter. Dapat diimplementasikan dengan copying atau dapat pula diimplementasikan dengan mentransmit sebuah access path tetapi tidak direkomendasikan.
Kerugian bila menggunakan physical move: membutuhkan storage tambahan dan actual move dapat menimbulkan kerugian materi.
Kerugian bila menggunakan access path method: harus menggunakan write-protect dalam subprogram dan access memakan cost lebih.
2. Pass-by-Result
Dalam proses ini, tidak ada nilai yang ditransmit ke subprogram, corresponding formal parameter bertindak sebagai local variable. Membutuhkan extra storage dan copy operation.
3. Pass-by-Reference
Melalui sebuah access path. Biasa dikenal juga dengan nama pass-by-sharing.
Keuntungan: proses dilakukan dengan efisien (tanpa copying dan tanpa extra storage).
Kerugian: proses berjalan lebih lamban dibandingkan pass-by-value, berpotensi menimbulkan efek samping dan aliases yang tidak diinginkan.
Overloaded Subprogram
An overloaded subprogram is one that has the same name as another subprogram in the same referencing environment.
C++, Java, C#, and Ada include predefined overloaded subprograms.
In Ada, the return type of an overloaded function can be used to disambiguate calls (thus two overloaded functions can have the same parameters).
Ada, Java, C++, and C# allow users to write multiple versions of subprograms with the same name.
Generic Subprogram
A generic or polymorphic subprogram takes parameters of different types on different activations.
Overloaded subprograms provide ad hoc polymorphism.
Subtype polymorphism means that a variable of type T can access any object of type T or any type derived from T (OOP languages).
A subprogram that takes a generic parameter that is used in a type expression that describes the type of the parameters of the subprogram provides parametric polymorphism.
A cheap compile-time substitute for dynamic binding
Leave a reply