Reputation: 65
So I am using an abstract class for the first time in PHP and am struggling to get it working. It is probably simple (as ever!). When I try to instantiate the class B, PHP throws this error
Fatal error: Class 'B' not found in /var/www/test/class/B.class.php on line 12
Abstract Class A
abstract class A
{
public function A()
{
//do something...
}
}
Class B
include 'A.class.php'; //abstract class A is in a different file
$b = new B(); //instantiate class B (Line 12, error points to here)
class B extends A
{
public function B()
{
//do something...
}
}
Upvotes: 0
Views: 1545