Override

Override is one of  feature in OOP (Object Oriented Programming) that allows child use same name when create a method with parent even the method provide different implementation inside.

For example we create class ‘parent’ and ‘child’ that have same function, like code bellow:

Class Parent{

Function Size(){

return 3;

}

}

 

Class Child extends{

Function Size(){

return 2;

}

}

When we instantiation class parent and call function Size, we will get 3 but when we Instantiation class child and call function Size, we will get 2 even in code class Child extends class Parent

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s