// A is the core class
class A{
public $lang;
function sayhi($name){echo "Hi".$name;}
function speak(){echo "Can Speak".$this->lang;}
}
class B {
function TODO(){
echo " Go to work ";
}
}
我現在還像這樣:如何在OOP中實現?
class C extends B {
function TODO(){
//more implement here
$a = new A();// here I created an instance.
// do any actions for A
$a->sayhi("Newbie");
}
}
但我想B類有A類的所有構造?
所以當我對C類DO(只是這樣的事情)
class C extends B {
function TODO(){
//more implement here
// I wish I can
sayhi("Newbie");
}
}
任何人能告訴我怎麼能實現呢?
yes.thanks您的幫助 – newbie 2011-05-17 14:54:06
不客氣。 – Yuankun 2011-05-17 14:56:47