I am writing a code in drupal custom module
It throws error while adding public keyword before abstract
public abstract class testParent {
public function abc() {
return 1;
}
}
// Class to extent abstract class property
class testChild extends testParent {
public function xyz() {
//body of your function
}
}
$a = new testChild();
print $a->abc();
The members of a class may be limited in visibility, but all classes are essentially 'public' in PHP.
http://php.net/manual/en/language.oop5.visibility.php
You will get a syntax error if you try to use the public keyword on a class (something like PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC)
)