I am wondering is is possible and how would it look if I extended class further then to one child. And when I do how would I access the main parent methods and propertys?
This is not my code, but that is the idea I am trying to understand.
`
class A{
$n;
}
class B extends A {
//Do somthing
}
class C extends B{
$this->n = "Hello"
}
`
And also does A constructor run if I init C?
And at the top of php file I have to include both files where the classes are located, correct?
>Solution :
Yes, it is possible to extend a class further down the inheritance chain, as you have shown with the classes B and C extending A. When you extend a class, the child class will have access to all of the methods and properties of the parent class, as well as any methods and properties that are defined in the child class itself.
In the example you provided, the value of $n would be set to "Hello" in the C class. If you instantiate an object of the C class, you would be able to access the value of $n by calling $object->n