Abstract classes in PHP are classes that cannot be instantiated on their own and are designed to be inherited by other classes. They can contain both abstract and concrete methods.
Abstract classes are defined using the abstract keyword, and any class that contains at least one abstract method must be declared as an abstract class.
<?php abstract class AchivementType { public function name(){ $class = (new ReflectionClass($this))->getShortName(); return trim(preg_replace('/[A-Z]/','$0', $class)); } public function icon() { return strtolower(str_replace('','-', $this->name())).'.png'; } abstract public function qualifier($user); }
I hope that you have clearly understood the concept of abstract classes.
위 내용은 OOP의 추상 클래스의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!