I recently read an article on Wikipedia about Design Pattern
So far I've done this, but it returns Fatal error: Maximum function nesting level of '100' reached, aborting!
Logically I know, it will return nesting error, But, I don't understand how is the best step.
class Main {
$this->Aa = new Aa;
$this->Bb = new Bb;
$this->Cc = new Cc;
}
class Aa extends Main {
function blahA() {
// blah blah
}
function testA() {
$ret[] = $this->blahA(); // Call inside class
$ret[] = $this->Bb->blahB(); // Call outside class
$ret[] = $this->Cc->blahC(); // Call outside class
return $ret;
}
}
class Bb extends Main {
function blahB() {
// blah blah
}
function testB() {
$ret[] = $this->blahB(); // Call inside class
$ret[] = $this->Aa->blahA(); // Call outside class
$ret[] = $this->Cc->blahC(); // Call outside class
return $ret;
}
}
class Cc extends Main {
function blahC() {
// blah blah
}
function testC() {
$ret[] = $this->blahC(); // Call inside class
$ret[] = $this->Aa->blahA(); // Call outside class
$ret[] = $this->Bb->blahB(); // Call outside class
return $ret;
}
}
Basically i want to manage my classes design, in order the method in Aa
class is also reusable in Bb
class and vice versa.
I curious, how to build the relationship like my classes above, How to extends
the class to get above pattern? And what is the name of this pattern? please also give me a link that i can learn from.
Many Thanks,