> For the complete documentation index, see [llms.txt](https://cnahmet.gitbook.io/asp-net-notlarim/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cnahmet.gitbook.io/asp-net-notlarim/nesne-tabanli-programlama/abstract-class.md).

# Abstract Class

Soyutlama, sadece girdi ve çıktıya bakıp içeride dönen işlemlerin gizlenmesi olarak açıklanabilir.

{% hint style="danger" %}
abstract class tan object üretilmez.
{% endhint %}

```aspnet
    class Shape {
        public int Width { get; set; }
        public int Height { get; set; }
        public Shape(int w, int h)
        {
            this.Width = w;
            this.Height = h;
        }

        public int AlanHesapla(){
            return this.Width * this.Height;
        }

        public virtual void Draw () {
            Console.WriteLine("Şekil çiz");
        }
    }

    class Square:Shape {

        public Square(int w, int h):base(w,h)
        {
            
        }
        public override void Draw () {
            Console.WriteLine("Kare çiz");
        }
    }

    class Rectangle:Shape {
        public Rectangle(int w, int h):base(w,h)
        {
            
        }
        public override void Draw () {
            Console.WriteLine("Dikdörtgen çiz");
        }
    }

    class Program
    {

        static void Main(string[] args)
        {
            var shapes = new Shape[3];
            
            shapes[0] = new Square(15,15);
            shapes[1] = new Rectangle(20,25);
            shapes[2] = new Rectangle(3,5);

            foreach (var shape in shapes){
                shape.Draw();
                Console.WriteLine($"Alan: {shape.AlanHesapla()}");
            }
        }
    }
    
/*
Çıktısı

Kare çiz
Alan: 225
Dikdörtgen çiz
Alan: 500
Dikdörtgen çiz
Alan: 15
*/

```
