I'm officially mentally retarded. [Let me explain]
I've never really given classes and their relationship any thought until today. I'm trying to figure out something that seems to be pretty obvious but since I'm stupid I can't see it.
Let's say I have a Core Class that will be extended from different files. How can children classes call functions from other siblings (that is if those are considered childs at all). Sample Code: (don't kill me)
class cOne {
public function functionOne(){
echo "something";
}
}
Then on another file, I say:
class cOneChildOne extends cOne {
public function functionOne(){
echo "something from child one";
}
}
And yet on another file I say:
class cOneChildTwo extends cOne {
public function functionOne(){
echo "something from child two";
}
}
How would I have to create a new object, and when, so that I'm able to access functions from both childs and the parent class in a fashion similar to $newObject->Children->function();
I'm seriously considering the option that I've completely lost my brain today and can't think straight.
I've obviously doing something wrong since: $newObject = new cOne;
creates the object but then the code from one of the subclasses is unable to access anything that's not directly in the core class or in itself.
It's not like it's vitally important or anything but I'd like to understand this. I've done a lot of reading don't get me wrong, that's why I consider myself retarded and not just lazy.
Help me or shoot me!! Thanks