我有一个场景,我有三个单独的类文件 A.php、B.php、C.php。
A.php 是具有一些功能的独立文件,“B”扩展“A”,“C”扩展“B”。
在“C.php”文件中,我可以访问“B.php”的功能,但不能访问“A.php”的功能。
这是我的结构-
在 A.php -
class A {
public function testA(){
echo "AA";
}
}
在 B.php -
class B extends A{
public function testB(){
echo "BB";
}
}
在 C.php -
class C extends B{
//Here i am able to call class B's function like
public function testC(){
$this->testB();
}
//but not able to call Class A's function
public function testC1(){
$this->testA(); // Here its giving error
}
}
请让我知道这样做是否正确。如何在“C.php”中访问“A.php”函数
问候