Materi ke - 3 ( 10 Maret 2026 )
Inheritance (Pewarisan)
- Pengantar OOP
Pemrograman Berorientasi Objek (OOP) terdiri dari:
- Encapsulation = atribut, operasi
- Inheritance = pewarisan ( kecuali private )
- Polymorphism = nama sama tingkah laku bebeda
- Abstraction = tidak detai hanya ringkas
- Definisi Inheritance
- Konsep Dasar
- Class yang mewariskan disebut : Superclass / Parent
- Class yang menerima disebut : Subclass / Child
- Tujuan Inheritance
- Reusability kode
- Mengurangi duplikasi kode
- Membentuk hubungan antar class
- Keyword Extend
- Keuntungan Inheritance
- Menghemat waktu pengembangan
- Struktur program lebih rapih
- Mempermudah pemeliharaan kode
- Method Inheritance
- Tipe Inheritance
- Single inheritance
- Hierarchical Inheritance
- Constructor dan Inheritance
- Keyword super
contoh : super.tampilInfo();
Komentar
Posting Komentar