DEV Community

hdemiray
hdemiray

Posted on

Abstract Classes / Abstract Sınıflar

Class yapısına sahiptir. Referans tiptir ama tamamen somut bir yapıya sahiptir.

Classın içerisinde operasyonlar bulunur.
Class : İçerisinde birbirisiyle ilgili operasyonları , field ve propertyleri tutan yapı.

Abstract Classta tanımlanan bir operasyon inherit edildiği sınıfta ezilmek (override) zorundadır.
Tamamlanmış operasyon (metod) da tutabilir yarım operasyonlarıda tutabilir(imza şeklinde).

Bir sınıf sadece bir sınıfı inherit edebileceği için dolayısı ile bir abstract class inherit edebilir başka bir classı inherit edemez.
Abstract classların normal classlardan tek farkı kabaca newlenememesi çünkü içerisinde tamamlanmamış operasyonlarda barındırabilir.

Peki abstract classlar constructor içerebilir mi ? Evet
Peki Nasıl çalışır ?

Sadece inherit edildiği class newlendiğinde çalışır ve constructor protected isim belirteci ile tanımlanmalıdır çünkü sadece inherit edildiği yerde kullanılabilir.

        abstract class MevzuatBase
        {
            public abstract void Degerlendir();
            public void Kaydet(){
                Console.Write("Kaydedildi !");
            }
        }
        class AMevzuat:MevzuatBase
        {
            public override void Degerlendir(){
                Console.Write("A Mevzuat Değerlendirdi !");
            }
        }
        
        class AMevzuat:MevzuatBase
        {
            public override void Degerlendir(){
                Console.Write("A Mevzuat Değerlendirdi !");
            }
        }```

Enter fullscreen mode Exit fullscreen mode

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay