Ec (2); In PHP5, abstract keywords are used to indicate abstract methods. Classes containing abstract methods are abstract classes, and abstract methods must also be used to indicate abstract methods. & Lt ;? Phpabstract & nbsp; class & nbsp; AbstractClass & nbsp; {& nbsp; abstract & nbsp; public & nbsp; function & nbsp; test ();} class & script ec (2); script
In PHP 5, abstract keywords are used to indicate abstract methods. classes that contain abstract methods are abstract classes. abstract keywords must also be used to indicate abstract methods.
Abstract class AbstractClass {
Abstract public function test ();
}
Class ImplementedClass extends AbstractClass {
Public function test (){
Echo "ImplementedClass: test () called .";
}
}
$ O = new ImplementedClass;
$ O-> test ();
?>
PHP 5 also supports the interface concept and introduces the interface and implements keywords for it. Like Java, PHP 5 uses interfaces to achieve the same effect as "Multi-inheritance. Syntax:
Interface displayable {
Function display ();
}
Interface printable {
Function doprint ();
}
Class foo implements displayable, printable {
Function display (){
// Code
} Function doprint (){
// Code
}
}
?>
The introduction of abstract classes and interfaces makes PHP a fully object-oriented language. The syntax is too similar to Java.
</