Read this article in your language IT | EN | DE | ES
Merhaba Arkadaşlar bu makkalede
sizlere c# Abstract Soyut Sınıflardan
anlatım yapacağım öncelikle abstract sınıfı tanıyalım soyut sınıfın oluşumu
using System;
/// <summary>
/// Author Orhan Türk
/// WebSite : http://orhanturk.com.tr
/// Proje Description Soyutlama
(Abstraction)
/// </summary>
abstract public class MotorVehicle
{
//
property tanımlıyoruz
public string make;
public string model;
public MotorVehicle(string _make, string _model)
{
this.make = _make;
this.model = _model;
}
abstract public void Accelerate();
}
/// <summary>
/// oluşturmuş oldugumuz class MotorVehicle class oluşturmuş oldumuz class cagıryoruz
/// </summary>
public class Product : MotorVehicle
{
public Product(string make, string model) :
//burada base tip üretiyoruz
base(make, model)
{
// do nothing
}
/// <summary>
/// Burada metod override ediyoruz
/// </summary>
public override void Accelerate()
{
Console.WriteLine("In
Product Accelerate() method");
Console.WriteLine(model + " accelerating");
}
}
class MainClass
{
/// <summary>
/// Burada Product tip
instance oluşturuyoruz
///
/// </summary>
public static void Main()
{
Product myProduct = new Product("Toyota", "MR2");
myProduct.Accelerate();
Console.ReadLine();
}
}
Projenin Full Source Code Ekliyorum
Abstact.rar (20,18 kb)
Evet Arkadaşlar Bir makkenin sonuna daha gelmiş olduk Başka bir makkalede görüşmek üzere
Saygılarımla Orhan Türk
8c03404e-fb01-46d1-b7d0-4ff6ed267bbe|0|.0
C#
c# abstract, soyutlama