+ 2
What is abstract class??
3 Antworten
+ 3
When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class.
+ 1
abstract class is class which contain one or more abstract method/function. Abstract method is a incomplete method.
public function doSomething(); This method is a abstract method.
when we create a class contain this kind of method/function is called abstract class.
eg.
abstract class ABC{
abstract public function doSomething()
}
class XYZ extends ABC
{
// Our child class may define optional arguments not in the parent's signature
public function doSomething($name) {
return $name;
}
}
$obj = new XYZ;
echo $abj-> doSomething("Dev");
0
a class which have declare with abstract key word then it is called as abstract class
we can not create object of abstract class
abstract class may or maynot contain abstract method
abstract class will be override by its sib class which is derived from the abstract class
syntax:
accessspecifier abstract class<class name>
{
propeeties
method
constructor
}