thursday'snotes
this site the web

Inheritance, Overloading, Overriding adalah:

Inheritance: hubungan antara dua kelas atau lebih dimana salah satu kelasnya mendeklarasikan kelas lainnya sebagai parent class. Class turunannya mewarisi seluruh property dan behaviour dari parent classnya.

Contoh Inheritance:

public class Animal
{
...
}

public class Mamalia : Animal
{
...
}


Overloading : adalah dua atau lebih method yang namanya sama tetapi signaturenya berbeda.

Contoh Overloading:

public class Animal( )
{
...
}

public class Animal( string Jenis)
{
...
}

Overriding : adalah satu atau lebih method yang namanya sama, signaturenya sama tetapi isinya berbeda dan biasanya terjadi pada inheritance class.

Contoh Overriding:

public class Animal
{
public string reproduce( )
{
Console.WriteLine(”Animal”);
}
}
public class Mamal : Animal
{
public string reproduce( )
{
Console.WriteLine(“Mamal”);
}
}

0 comments:

Post a Comment

 

Disclaimer

I do not claim any of these images as my own unless otherwise stated

The views and opinions expressed on this blog are 100% mine. If I claim or appear to be an expert on a certain topic or product or service area, I will only endorse products or services that I believe, based on my expertise, are worthy of such endorsement. Any product claim, statistic, quote or other representation about a product or service should be verified with the manufacturer or provide

About Thursday's Notes

This blog is a personal blog written and edited by me, and does not reflect the views of either employers and/or clients. This blog does not accept any form of cash advertising, sponsorship, or paid topic insertions.