Inheritance atau pewarisan memungkinkan penciptaan kelas baru yang mewarisi properti dan metode dari kelas induk. Kelas turunan dapat menambahkan atau menimpa perilaku asli serta mewarisi akses level dari properti dan metode kelas induk. Pewarisan tunggal dan ganda merupakan jenis pewarisan utama dalam pemrograman berorientasi objek.
Modul Praktikum Pemrograman Berorientasi Objek (Chap.12)Debby Ummul
Modul ini berisi materi praktikum tentang pembuatan aplikasi CRUD perpustakaan. Sebenarnya ini adalah edisi revisi dari modul sebelumnya yaitu Chapter 11. hehe....
Bahasa yang digunakan masih sama yaitu menggunakan bahasa Java
Inheritance, polymorphism, dan interface memungkinkan pembuatan hierarki kelas yang fleksibel dan reusabilitas kode. Interface dan kelas abstrak memungkinkan definisi perilaku standar tanpa menentukan implementasi. Polymorphism memungkinkan objek-objek dari subclass yang berbeda diperlakukan sebagai objek dari superclass.
Buku petunjuk penggunaan_internet_bankingardianisti
Dokumen tersebut memberikan panduan lengkap tentang berbagai jenis transaksi yang dapat dilakukan melalui internet banking Bank Mandiri seperti transfer dana antar rekening sendiri dan antar bank, pembayaran tagihan berbagai jenis, pembelian pulsa, penempatan deposito, serta informasi dan administrasi rekening.
Biological factors that influence ex conservation of narsalis lavartus 20Fatin Hasanah Firdaus
The document summarizes information about the Proboscis Monkey (Nasalis larvatus), a large and sexually dimorphic primate endemic to Borneo. It notes that the Proboscis Monkey is endangered due to habitat loss and hunting. Its natural habitat is lowland coastal rainforests, including mangroves and peat swamps. Ex-situ conservation methods like captive breeding are becoming increasingly important to preserve the species.
The document provides a detailed analysis of the mise-en-scene, camerawork, editing, and sound techniques used in the music video for "Beautiful Girl" by William Fitzsimmons. It analyzes how the low-key lighting, guitar playing, recurring bracelet, close-ups of the artist, montage editing, use of slow motion, cross-cutting, synchronous sound, and relationship between lyrics and narrative are conventionally used in music videos and the acoustic/folk genre to explore emotional themes and tell a narrative through visual and aural elements.
Modul Praktikum Pemrograman Berorientasi Objek (Chap.12)Debby Ummul
Modul ini berisi materi praktikum tentang pembuatan aplikasi CRUD perpustakaan. Sebenarnya ini adalah edisi revisi dari modul sebelumnya yaitu Chapter 11. hehe....
Bahasa yang digunakan masih sama yaitu menggunakan bahasa Java
Inheritance, polymorphism, dan interface memungkinkan pembuatan hierarki kelas yang fleksibel dan reusabilitas kode. Interface dan kelas abstrak memungkinkan definisi perilaku standar tanpa menentukan implementasi. Polymorphism memungkinkan objek-objek dari subclass yang berbeda diperlakukan sebagai objek dari superclass.
Buku petunjuk penggunaan_internet_bankingardianisti
Dokumen tersebut memberikan panduan lengkap tentang berbagai jenis transaksi yang dapat dilakukan melalui internet banking Bank Mandiri seperti transfer dana antar rekening sendiri dan antar bank, pembayaran tagihan berbagai jenis, pembelian pulsa, penempatan deposito, serta informasi dan administrasi rekening.
Biological factors that influence ex conservation of narsalis lavartus 20Fatin Hasanah Firdaus
The document summarizes information about the Proboscis Monkey (Nasalis larvatus), a large and sexually dimorphic primate endemic to Borneo. It notes that the Proboscis Monkey is endangered due to habitat loss and hunting. Its natural habitat is lowland coastal rainforests, including mangroves and peat swamps. Ex-situ conservation methods like captive breeding are becoming increasingly important to preserve the species.
The document provides a detailed analysis of the mise-en-scene, camerawork, editing, and sound techniques used in the music video for "Beautiful Girl" by William Fitzsimmons. It analyzes how the low-key lighting, guitar playing, recurring bracelet, close-ups of the artist, montage editing, use of slow motion, cross-cutting, synchronous sound, and relationship between lyrics and narrative are conventionally used in music videos and the acoustic/folk genre to explore emotional themes and tell a narrative through visual and aural elements.
The document discusses how the author appealed to her target audience by considering their hobbies and interests as well as people they idolized. She used a sketchy style header to potentially connect with an audience that enjoys less formal or traditional styles.
This document discusses transportation infrastructure challenges in Lafourche Parish, Louisiana. It focuses on LA Highway 1 (LA-1), which provides sole access to the critical Port Fourchon but is increasingly vulnerable to inundation from sea level rise and storms. Only half of the proposed 19-mile elevated highway from the levee to Port Fourchon has been completed. The document references studies finding that a 90-day outage of LA-1 could result in $7.8 billion in lost GDP and reduction of oil and gas supply. Upgrading LA-1 to an elevated highway is presented as critical for improving resiliency of transportation and energy infrastructure in the parish.
The simple past tense of regular verbs is formed by adding "ed" to the infinitive. There are some spelling changes depending on the ending of the verb. Irregular verbs do not follow this pattern and must be memorized. The infinitive form of the verb is used after "did" or "didn't" in questions.
This document discusses environmental conditions and coastal land loss in Lafourche Parish. It provides aerial photos and maps showing the parish's floodplain, areas impacted by hurricanes, and land loss from 1932 to 1990 according to the USGS. The document was created by Kimley-Horn and Associates and Waggonner & Ball Architects for Lafourche Parish's Comprehensive Resiliency Plan.
The document summarizes key demographics and psychographics of 9-13 year old females. It finds that they are primarily working or middle class, with interests in fashion, music, makeup, and gossip as well as outdoor activities like cycling and swimming. Their lifestyle is described as social, active, fashionable, healthy and busy.
This document compares the front covers of two magazines. It notes the key design elements of each cover including the masthead, slogan, center image, colors used, fonts, barcodes and price. The contents page layout is also described, highlighting the header, page references, images and fonts used.
The document analyzes employment in Lafourche Parish. It finds that in 2010, the largest employment sectors were transportation, retail, and construction, which together accounted for over 40% of jobs. Transportation forms the basis of the parish's economy. While these sectors have grown, other sectors like health care and administrative jobs are growing faster. The parish aims to diversify its economy by developing emerging sectors such as environmental tech, food services, eco-tourism, and health care. It also seeks to improve infrastructure to attract and retain businesses and jobs.
The document discusses comprehensive planning for Lafourche Parish. A comprehensive plan is a shared community vision and policy blueprint that guides growth, development, transportation, housing, and other elements over 15-20 years. The planning process involves input from community members, businesses, organizations, and government to establish a plan that reflects the unique attributes and vision for Lafourche Parish.
This service manual provides information for servicing the IC-2720H dual band FM transceiver. It contains sections on specifications, circuit descriptions, parts lists, mechanical disassembly instructions, board layouts, and voltage diagrams. Safety warnings are provided, and instructions specify using insulated tools and connecting attenuators when testing.
The document discusses various aspects of stress and intonation in English, including how stress is realized through louder, longer, and higher pitched syllables and how intonation contributes to the meaning and expression of utterances through rising and falling tones. Word stress rules and patterns of primary, secondary, tertiary, and quaternary stress are examined along with examples of different types of stress including emphatic, contrastive, tonic, and new information stress.
A União Europeia está preocupada com o impacto ambiental do plástico descartável e planeja proibir itens como canudos, talheres e pratos de plástico até 2021 para reduzir os resíduos plásticos nos oceanos. A proibição afetará produtos de plástico de único uso que são comumente encontrados nas praias e águas da UE. Espera-se que a medida ajude a prevenir danos à vida marinha e à cadeia alimentar.
Dokumen tersebut membahas tentang konsep pewarisan (inheritance) dalam pemrograman berorientasi objek Java, termasuk definisi inheritance, deklarasi inheritance, hubungan antara kelas induk dan turunan, serta contoh penerapannya.
Polimorfisme memungkinkan objek dari subclass untuk menimpa perilaku yang diwarisi dari superclass. Overloading memungkinkan method dengan nama yang sama tetapi parameter yang berbeda. Overriding memungkinkan subclass untuk menimpa implementasi method dari superclass.
1. Dokumen tersebut membahas konsep-konsep dasar pemrograman berorientasi objek seperti class, properti, method, objek, konstruktor, abstraksi, enkapsulasi, pewarisan, dan polimorfisme.
2. Class digunakan sebagai blueprint untuk membuat objek, properti dan method mendefinisikan karakteristik dan perilaku objek, sedangkan objek merupakan instansiasi dari class.
3. Konsep-konsep tersebut kemudian diterjem
Dokumen tersebut membahas konsep-konsep seperti overloading, overriding, dan final class/method dalam PHP beserta contoh kodenya. PHP tidak sepenuhnya mendukung overloading seperti bahasa lain namun menyediakan magic method untuk keperluan serupa."
The document discusses how the author appealed to her target audience by considering their hobbies and interests as well as people they idolized. She used a sketchy style header to potentially connect with an audience that enjoys less formal or traditional styles.
This document discusses transportation infrastructure challenges in Lafourche Parish, Louisiana. It focuses on LA Highway 1 (LA-1), which provides sole access to the critical Port Fourchon but is increasingly vulnerable to inundation from sea level rise and storms. Only half of the proposed 19-mile elevated highway from the levee to Port Fourchon has been completed. The document references studies finding that a 90-day outage of LA-1 could result in $7.8 billion in lost GDP and reduction of oil and gas supply. Upgrading LA-1 to an elevated highway is presented as critical for improving resiliency of transportation and energy infrastructure in the parish.
The simple past tense of regular verbs is formed by adding "ed" to the infinitive. There are some spelling changes depending on the ending of the verb. Irregular verbs do not follow this pattern and must be memorized. The infinitive form of the verb is used after "did" or "didn't" in questions.
This document discusses environmental conditions and coastal land loss in Lafourche Parish. It provides aerial photos and maps showing the parish's floodplain, areas impacted by hurricanes, and land loss from 1932 to 1990 according to the USGS. The document was created by Kimley-Horn and Associates and Waggonner & Ball Architects for Lafourche Parish's Comprehensive Resiliency Plan.
The document summarizes key demographics and psychographics of 9-13 year old females. It finds that they are primarily working or middle class, with interests in fashion, music, makeup, and gossip as well as outdoor activities like cycling and swimming. Their lifestyle is described as social, active, fashionable, healthy and busy.
This document compares the front covers of two magazines. It notes the key design elements of each cover including the masthead, slogan, center image, colors used, fonts, barcodes and price. The contents page layout is also described, highlighting the header, page references, images and fonts used.
The document analyzes employment in Lafourche Parish. It finds that in 2010, the largest employment sectors were transportation, retail, and construction, which together accounted for over 40% of jobs. Transportation forms the basis of the parish's economy. While these sectors have grown, other sectors like health care and administrative jobs are growing faster. The parish aims to diversify its economy by developing emerging sectors such as environmental tech, food services, eco-tourism, and health care. It also seeks to improve infrastructure to attract and retain businesses and jobs.
The document discusses comprehensive planning for Lafourche Parish. A comprehensive plan is a shared community vision and policy blueprint that guides growth, development, transportation, housing, and other elements over 15-20 years. The planning process involves input from community members, businesses, organizations, and government to establish a plan that reflects the unique attributes and vision for Lafourche Parish.
This service manual provides information for servicing the IC-2720H dual band FM transceiver. It contains sections on specifications, circuit descriptions, parts lists, mechanical disassembly instructions, board layouts, and voltage diagrams. Safety warnings are provided, and instructions specify using insulated tools and connecting attenuators when testing.
The document discusses various aspects of stress and intonation in English, including how stress is realized through louder, longer, and higher pitched syllables and how intonation contributes to the meaning and expression of utterances through rising and falling tones. Word stress rules and patterns of primary, secondary, tertiary, and quaternary stress are examined along with examples of different types of stress including emphatic, contrastive, tonic, and new information stress.
A União Europeia está preocupada com o impacto ambiental do plástico descartável e planeja proibir itens como canudos, talheres e pratos de plástico até 2021 para reduzir os resíduos plásticos nos oceanos. A proibição afetará produtos de plástico de único uso que são comumente encontrados nas praias e águas da UE. Espera-se que a medida ajude a prevenir danos à vida marinha e à cadeia alimentar.
Dokumen tersebut membahas tentang konsep pewarisan (inheritance) dalam pemrograman berorientasi objek Java, termasuk definisi inheritance, deklarasi inheritance, hubungan antara kelas induk dan turunan, serta contoh penerapannya.
Polimorfisme memungkinkan objek dari subclass untuk menimpa perilaku yang diwarisi dari superclass. Overloading memungkinkan method dengan nama yang sama tetapi parameter yang berbeda. Overriding memungkinkan subclass untuk menimpa implementasi method dari superclass.
1. Dokumen tersebut membahas konsep-konsep dasar pemrograman berorientasi objek seperti class, properti, method, objek, konstruktor, abstraksi, enkapsulasi, pewarisan, dan polimorfisme.
2. Class digunakan sebagai blueprint untuk membuat objek, properti dan method mendefinisikan karakteristik dan perilaku objek, sedangkan objek merupakan instansiasi dari class.
3. Konsep-konsep tersebut kemudian diterjem
Dokumen tersebut membahas konsep-konsep seperti overloading, overriding, dan final class/method dalam PHP beserta contoh kodenya. PHP tidak sepenuhnya mendukung overloading seperti bahasa lain namun menyediakan magic method untuk keperluan serupa."
Buku panduan ini memberikan penjelasan komprehensif tentang konsep dasar dan teknik-teknik penting dalam memahami framework Laravel seperti autoloader, abstract class, interface, dependency injection, dan lainnya. Buku ini berisi contoh-contoh kode yang mudah dipahami untuk mempelajari penerapan konsep-konsep tersebut dalam pemrograman PHP menggunakan Laravel.
Atribut kelas Kapsul:
- private double panjang
- private double lebar
- private double tinggi
Method kelas Kapsul:
- private double luas(double p, double l)
Accessor method kelas Kapsul:
- public double getPanjang()
- public double getLebar()
Mutator method kelas Kapsul:
- public void setPanjang(double panjang)
- public void setLebar(double lebar)
Objek pada kelas Enkapsulasi:
- Kapsul pp = new Kapsul()
Dokumen tersebut merangkum materi pelatihan Java Application Developer pada sesi ke-5. Materi yang disampaikan meliputi pemrograman berorientasi objek meliputi konsep inheritance, polymorphism, kelas dan method abstrak, serta interface. Contoh kode program diberikan untuk mengilustrasikan konsep-konsep tersebut.
Atribut dari Kelas Kapsul
- private double panjang
- private double lebar
- private double tinggi
Method dari Kelas Kapsul
- private double luas(double p, double l)
Accessor Method dari Kelas Kapsul
- public double getPanjang()
- public double getLebar()
Mutator Method dari Kelas Kapsul
- public void setPanjang(double panjang)
- public void setLebar(double lebar)
Objek pada kelas Enkapsulasi
- Kapsul pp
1. Inheritance adalah pembuatan kelas baru berdasarkan kelas yang sudah ada sebelumnya sehingga sifat-sifatnya dapat diturunkan.
2. Kelas yang diturunkan membentuk hubungan hirarki dengan kelas induknya.
3. Tujuan inheritance adalah membuat kelas baru yang lebih spesifik dengan menurunkan sifat dari kelas induk serta memakai ulang kode kelas induk.
Tulisan ini membahas penggunaan framework Zend untuk membangun aplikasi PHP. Secara singkat, tulisan ini menjelaskan tentang struktur folder dan file-file dasar yang dibutuhkan untuk memulai pengembangan dengan Zend framework, termasuk cara membuat controller, view, dan form inputan sederhana.
1. Inheritance atau pewarisan adalah kalimat yang pasti ada di dalam pemerograman
berorientasi objek disebut juga dengan istilah reusable.
Salah satu kelebihan menggunakan sebuah kelas yaitu kita dapat membuat kelas inherits.
Pewarisan (inheritance) dilakukan dengan memperpanjang (extends) kelas yang sudah
ada dengan cara membuat kelas baru yang mewarisi (inherits) semua properti dan metode
yang ada pada kelas aslinya (parent class).
Ketika menggunakan kembali atau mengganti method dari class yang sudah ada, serta
ketika menambahkan field instant dan method baru, maka pada saat itulah Anda bekerja
dengan inheritance. Konsep ini merupakan konsep yang fundamental dalam orientasi
objek dan harus digunakan dengan baik, ada beberapa macam Inheritance atau pewarisan
yang ada di dalam OOP Single Inheritance dan Multple Inheritance
- Single Inheritance
- Multiple Inheritance
dalam penggunaan inheritance class Induk akan mewariskan semua atribut yang ia miliki
sehingga class bawahnya akan memilki atribut yang sama dengan class induk, bahkan
dapat memilki kebabasan untuk memilki atribut berbeda dengan class induknya berikut
ilustrasi dalam php
catatan :
sampai sekarang PHP belum mendukung multiple inheritance seperti C++ walapun PHP
dan c/c++ begitu banyak kemiripannya, dan perubahan PHP versi 5 ditekankan pada OOP
salah satunya adalah beberapa tambahan untuk kemampuan inheritance
contoh pewarisan
<?php
class Bapak {
var $nama =”Bapak”;
function Bapak($n) {
2. $this->nama = $n;
}
function Hallo() {echo “Halo, saya $this->nama
”;}
}
class Anak extends Bapak {}
$test = new Anak(”Anak dari Bapak”);
$test->Hallo();
?>
Hasil tampilan dari listing program di atas adalah “Halo, saya Anak dari Bapak” dan
bukannya “Halo, saya Bapak”. Mengapa demikian? Memang di dalam class Bapak
didefinisikan variabel nama dengan nilai Bapak, selanjutnya kita membuat objek dari
class Anak yang merupakan turunan dari class Bapak. Lihat bahwa instantiasi sekaligus
mengisikan parameter baru “Anak dari Bapak”, sehingga ketika dipanggil maka
mengisikan $this->nama dengan parameter tersebut. Ada pun di dalam implementasi
pemrograman, kebanyakan pemrogram merasakan beberapa manfaat dari inheritance atau
pewarisan, diantaranya:
Subclass mampu menyediakan perilaku khusus dari elemen dasar yang disediakan oleh
superclass.
Pemrogram dapat mengimplementasikan superclass untuk memanggil class abstrak yang
menyatakan perilaku umum.
Contoh lagi :
<?php
// parent class
class jenisMakanan {
public $public = "krupuk udang";
protected $protected = "enak sekali";
private $private = "tidak enak";
// metode/fungsi disini
}
// inherits class
class rasaMakanan extends jenisMakanan {
function rasa1() {
echo $this->public . " " . $this->protected;
}
function rasa2() {
3. echo $this->public . " " . $this->private;
}
}
$makanan = new rasaMakanan();
$makanan->rasa1(); // Hasil: krupuk udang enak sekali
$makanan->rasa2(); // Hasil: krupuk udang
?>
Pada contoh diatas, terlihat jelas bahwa properti public dan protected dapat
ditampilkan dengan memanggil obyek yang ada pada kelas inherits, yaitu kelas
rasaMakanan. Sedangkan properti private tidak dapat ditampilkan pada kelas inherits
tersebut. Perlakuan access modifiers pada metode-metode yang ada pada kelas tersebut
sama perlakuannya terhadap properti-properti seperti yang sudah dijelaskan.
Contoh maning :
<?php
class KendBermotor {
public $mesin;
private $roda;
protected $jalur;
function __construct() {
$this->mesin = "Kendaraan Bermotor Punya Mesin <br>";
$this->roda = "Kendaraan Bermotor Punya Roda <br>";
$this->jalur = "Kendaraan Bermotor Punya Jalur <br>";
}
function getMesin() {
return $this->mesin;
4. }
function getJalur() {
return $this->jalur;
}
function getRoda() {
return $this->roda;
}
}
// Class turunan dari KendBermotor
class KapalLaut extends KendBermotor {
private $baling2;
function __construct() {
// Dapat dijalankan
$this->mesin = "Kapal Laut Punya Mesin <br>";
$this->jalur = "Kapal Laut Punya Jalur <br>";
$this->baling2 = "Kapal Laut Punya Baling-baling <br>";
// Tidak dapat diakses
$this->roda = "Kapal Laut Punya Roda";
}
function getBaling2() {
return $this->baling2;
}
}
$KB = new KendBermotor();
echo "<p><b> Kriteria Kendaraan Bermotor : </b><br>";
echo $KB->getMesin();
echo $KB->getRoda();
echo $KB->getJalur();
$KL = new KapalLaut();
echo "<p><b> Kriteria Kapal Laut : </b><br>";
// Dapat diakses
echo $KL->getMesin();
echo $KL->getBaling2();
echo $KL->getJalur();
?>
Hasilnya : ??????????
5. Example again :
<?
class Kendaraan{
//atribut-atribut
var $merek,$jmlroda;
//konstruktor
function __construct($m){
$this->merek=$m;
}
//method-method...
function tampilkanMerek(){
return $this->merek;
}
function isiJmlRoda($jml){
$this->jmlroda=$jml;
echo " Jumlah rodanya ".$this->jmlroda;
}
function bergerak($arah){
echo " bergerak ke arah ".$arah;
}
}
//instansiasi kelas Kendaraan menjadi object $kijang
$kijang = new Kendaraan("Kijang");
echo "Sebuah kendaran bermerek ".$kijang->tampilkanMerek();
$kijang->isiJmlRoda(4);
$kijang->bergerak("Utara");
class Motor extends Kendaraan{
var $harga;
function __construct($mrk,$hrg){
//akses konstruktor Kendaraan (super)
parent::__construct($mrk);
$this->harga = $hrg;
}
function tampilkanHarga(){
return $this->harga;
}
function bergerak($arah){
echo "maju ke arah $arah";
}
}
//instansiasi kelas Motor menjadi object $honda
$honda = new Motor("Honda",12000000);
echo "Sebuah Kendaraan bermerek ".$honda->tampilkanMerek()."
dengan harga Rp.";
printf(number_format($honda->tampilkanHarga(),2,',','.'));
6. $honda->isiJmlRoda(2);
$honda->bergerak("Selatan");
?>
Setelah object $honda memberi tahu merek dan harganya, dia mengisi jumlah roda
dengan menthod kelas Kendaraan, tapi bergerak dengan method khusus kelas Motor.
Kelas turunan akan mewariskan atribut-atribut dan method-method baseclass/parentclass-
nya.
Ketika $honda mengisi jumlah roda, dia mengisi jumlah roda dengan method Kendaraan,
tetapi ketika bergerak, dia bergerak dengan method baru yang didefinisikan khusus pada
kelas Motor(“maju ke arah $arah”), inilah yang disebut dengan method overriding, yaitu
suatu kondisi di mana derived class menolak method base / parent classnya.