Class A
/*
* Created by SharpDevelop.
* User: Joko
* Date: 10/08/2015
* Time: 15:46
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace Abstract_Class_C_
{
public abstract class A
{
public abstract void Nama(string nm);
public abstract void NIM(int nim);
}
}
Class B
/*
* Created by SharpDevelop.
* User: Joko
* Date: 10/08/2015
* Time: 15:45
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace Abstract_Class_C_
{
public class B : A
{
public override void Nama(string nm)
{
Console.WriteLine("Nama Mahasiswa = "+nm);
}
public override void NIM(int nim)
{
Console.WriteLine("NIM = "+nim);
}
}
}
main program
/*
* Created by SharpDevelop.
* User: Joko
* Date: 10/08/2015
* Time: 15:14
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace Abstract_Class_C_
{
class Program
{
public static void Main(string[] args)
{
B b = new B();
b.Nama("Joko Prasetyo");
b.NIM(1113101102);
Console.ReadKey(true);
}
}
}
No comments:
Post a Comment
Untuk pengunjung Prasetyo-Online diharapkan berkomentar dengan sopan dan ber-etika. Terimakasih atas kunjungannya, nantikan update info dan tutorial terbaru dari kami. Salam bloggers Indonesia.