> For the complete documentation index, see [llms.txt](https://docs.layraweb.com.tr/merhaba/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layraweb.com.tr/merhaba/php-tarafi/konular/siniflar-ve-nesneler/soyut-siniflar-ve-yontemler-abstract-classes-and-methods.md).

# Soyut Sınıflar ve Yöntemler (Abstract Classes and Methods)

PHP'de soyut sınıflar ve yöntemler, bir sınıfın soyut işlevselliğini belirleyen ve bir alt sınıfta uygulanması gereken özelliklerdir. Soyut sınıflar, doğrudan örneklenemeyen sınıflardır ve alt sınıflarında uygulamaları gereken yöntemler içerir.

Soyut sınıflar, genellikle bir arayüzü uygulayan bir veya daha fazla sınıf tarafından kullanılır ve bu arayüzdeki tüm yöntemleri uygulama zorunluluğu vardır. Ayrıca, soyut sınıflar alt sınıflarını kullanarak belirli bir işlevselliği sağlar ve kodun tekrarlanabilirliğini ve bakımını azaltır.

Aşağıdaki örnekte, bir Soyut\_Sinif adlı soyut bir sınıf tanımlanmaktadır. Bu sınıfın iki soyut yöntemi vardır: biri metot1, diğeri metot2'dir. Bu yöntemler alt sınıflar tarafından uygulanması gereken yöntemlerdir.

```php
abstract class Soyut_Sinif {
    abstract protected function metot1($arg1, $arg2);
    abstract protected function metot2($arg3);
}
```

Alt sınıflar bu soyut sınıfı genişletip, soyut yöntemleri uygulayabilirler. Aşağıdaki örnekte, Soyut\_Sinif sınıfından türetilen bir Alt\_Sinif adlı alt sınıf tanımlanmıştır. Bu alt sınıf, Soyut\_Sinif sınıfındaki soyut yöntemleri uygulamak zorundadır.

```php
class Alt_Sinif extends Soyut_Sinif {
    protected function metot1($arg1, $arg2) {
        // metot1 implementasyonu
    }

    protected function metot2($arg3) {
        // metot2 implementasyonu
    }
}
```

Soyut sınıflar ve yöntemler, genellikle büyük projelerde kullanılır ve sınıf hiyerarşilerini daha iyi organize etmeye yardımcı olur. Ayrıca, uygulamada zorunlu yöntemlerin uygulanmasını garanti altına alır ve bir sınıfın kullanılabilirliğini arttırır.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.layraweb.com.tr/merhaba/php-tarafi/konular/siniflar-ve-nesneler/soyut-siniflar-ve-yontemler-abstract-classes-and-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
