父对象 [英] Parent Objects
问题描述
我有
class thechild {
function sayTest()
{
parent ::测试(); //这个对吧???
}
}
class theparent {
功能测试()
{
echo" test";
}
function __construct()
{
$ e = new thechild();
$ e-> sayTest();
}
}
我如何让它工作?我试图获得一个班级(A)到
在其中创建另一个班级(B),但是班级B必须能够从班级调用一个函数
A.任何想法?
谢谢
Paul Jenkins
www.pjenkins.co.uk
e = new thechild ();
e-> sayTest();
}
}
如何让它工作?我试图获得一个班级(A)到
在其中创建另一个班级(B),但是班级B必须能够从班级调用一个函数
A.任何想法?
谢谢
Paul Jenkins
www.pjenkins.co.uk
paul.j写道:
< blockquote class =post_quotes>
我有
class thechild {
function sayTest()
{
parent :: test(); //这个对吧???
}
}
class theparent {
功能测试()
{
echo" test";
}
function __construct()
{
I have
class thechild{
function sayTest()
{
parent::test(); // this right???
}
}
class theparent{
function test()
{
echo "test";
}
function __construct()
{
$e = new thechild();
$e->sayTest();
}
}
How do i get this to work ? I am trying to get a one class (A) to
create another class (B) within it, but the class B must be able to
call a function from class A. Any ideas?
Thanks
Paul Jenkins
www.pjenkins.co.uk
e = new thechild();
e->sayTest();
}
}
How do i get this to work ? I am trying to get a one class (A) to
create another class (B) within it, but the class B must be able to
call a function from class A. Any ideas?
Thanks
Paul Jenkins
www.pjenkins.co.uk
paul.j wrote:I have
class thechild{
function sayTest()
{
parent::test(); // this right???
}
}
class theparent{
function test()
{
echo "test";
}
function __construct()
{
这篇关于父对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!