Dokumen tersebut membahas tentang konsep inheritance dalam pemrograman berorientasi objek. Inheritance memungkinkan suatu objek mewarisi atribut dan perilaku dari objek lain. Contoh inheritance diberikan dengan kelas hewan yang mempunyai subclass karnivora dan herbivora. Kelas hewan menjadi superclass yang dapat diwarisi oleh subclass.
Materi yang ada pada slide ini berisi :
Inheritance (Pewarisan)
Hak akses protected
Override Method
Override Constructor
Kata kunci super
Kata kunci final
----------------------------------------------------------------------
Keep in touch with me in :
Twitter : https://twitter.com/rizkiadam_1991
Email : rizkiadamunikom@gmail.com
Github : https://github.com/RizkiAdamKurniawan
IG : @rizkiadamkurniawan
The rumble of motorcycles will be heard throughout Rome on Aug. 27 as bikers wind their way through 86 miles of Floyd County roads.
Kangaroo Express Stations in Floyd County are sponsoring Roo Ride for Our Troops, a benefit motorcycle ride to benefit the USO, the Wounded Warrior Project and the Georgia National Guard.
The ride is part of the company’s nationwide effort to raise money for the three organizations that help the troops both in active duty and once they are home.
The ride will begin at 8:30 a.m. at the Woodmen of the World Park on Wilkerson Road. The ride will then loop throughout Floyd County before ending back at the park.
The cost is $25 per bike and $15 per additional rider. Bikers can register at any Kangaroo location in Floyd County, and registration will continue the morning of the event.
Materi yang ada pada slide ini berisi :
Inheritance (Pewarisan)
Hak akses protected
Override Method
Override Constructor
Kata kunci super
Kata kunci final
----------------------------------------------------------------------
Keep in touch with me in :
Twitter : https://twitter.com/rizkiadam_1991
Email : rizkiadamunikom@gmail.com
Github : https://github.com/RizkiAdamKurniawan
IG : @rizkiadamkurniawan
The rumble of motorcycles will be heard throughout Rome on Aug. 27 as bikers wind their way through 86 miles of Floyd County roads.
Kangaroo Express Stations in Floyd County are sponsoring Roo Ride for Our Troops, a benefit motorcycle ride to benefit the USO, the Wounded Warrior Project and the Georgia National Guard.
The ride is part of the company’s nationwide effort to raise money for the three organizations that help the troops both in active duty and once they are home.
The ride will begin at 8:30 a.m. at the Woodmen of the World Park on Wilkerson Road. The ride will then loop throughout Floyd County before ending back at the park.
The cost is $25 per bike and $15 per additional rider. Bikers can register at any Kangaroo location in Floyd County, and registration will continue the morning of the event.
Linkedin - Marketing a business on a social networkSarang Bhutada
Part of our mid-term assignment. The other part is an exhaustive report (with me at sarang.bhutada@gmail.com).
This presentation discusses the role of social networking and discusses the professional networking site – LinkedIn in particular. It also discusses the ways in which LinkedIn can be used by businesses, the various aspects that need to be looked into, and the potential benefits.
belajar lebih lanjut tentang inheritance,istilah yang ada dalam inheritance serta pendefinisian inheritance dalam konsep UML pada class diagram,.
selamat belajar :)
2. 1. Jelaskan istilah inheritance pada
Pemrograman Berorientasi Object !
2. Berikan contoh inheritance !
3. Gambar konsep inheritance pada UML Class
Diagram
3. Inheritance adalah dimana suatu entitas/obyek dapat
mempunyai entitas/obyek turunan. Dengan konsep
inheritance, sebuah class dapat mempunyai class
turunan.
Seperti halnya manusia pada umumnya terdapat orang tua dan
anak pada PBO juga dikenal parent class atau base
class dan subclass atau child
class.Dimana subclass atau childclass mewarisi semua data yang
ada di parent class atau base class atau dapat disimpulkan
jika subclass atau childclassadalah perluasan dari parent
class atau base class.
4. KEUNTUNGAN INHERITANCE :
1. Subclass menyediakan state/behaviour yang spesifik yang membedakannya dengan
superclass, hal ini akan memungkinkan programmer Java untuk menggunakan ulang
source code dari superclass yang telah ada.
2. Programmer Java dapat mendefinisikan superclass khusus yang bersifat generik, yang
disebut abstract class, untuk mendefinisikan class dengan behaviour dan state secara
umum.
ISTILAH INHERITANCE :
Extends : ini adalah keyword agar sebuah class menjadi subclass. Superclass :
Menunjukkan class yang berarti parent class dari subclass/class anak. Subclass : adalah
class anak atau turunan dari superclass/parent class. Super Keyword : untuk memanggil
konstruktor dari superclass atau menjadi variabel yang mengacu pada superclass.
Methode Overriding : Pendefinisian ulang method yang sama pada subclass Dalam
inheritance, method overriding berbeda dengan method overloading. Jika method
overriding adalah mendefinisikan kembali method yang sama, baik nama method
maupun signature atau parameter yang diperlukan dalam subclass, Sedangkan method
overloading adalah mendefinisikan method yang memiliki nama yang sama saja.
5. Contoh:
Kelas Main :
public class Main{
public static void main(String[] args){
karnivora harimau = new karnivora(“harimau”,”mamalia”);
herbivora gajah = new herbivora(“gajah”,”mamalia”);
karnivora hiu = new karnivora(“hiu”,”mamalia”);
herbivora kambing = new herbivora(“kambing”,”mamalia”);
herbivora ayam = new herbivora(“ayam”,”aves”);
System.out.println(harimau.getDetails() );
System.out.println(gajah.getDetails() );
System.out.println(hiu.getDetails() );
System.out.println(kambing.getDetails() );
System.out.println(ayam.getDetails() );
}
}
Kelas Hewan :
public class hewan {
public String nama;
public String jenis;
public hewan (String n, String j) {
nama = n;
jenis = j ;
}
public String getDetails() {
return “Name : “+nama+, “Jenis : “+jenis ;
}
public void makan () {
}
}