Question: I've noticed that in PHP the following code works with no complaints:

```
class A {            
    public static function echoes($b) {
        echo $b->protectedFunction();
    }        
}

class B extends A {
    protected function protectedFunction() {
        return "this is protected";
    }
}

$b = new B();
A::echoes($b);

```

Example <https://3v4l.org/JTpuQ> 

However I've tried this in C# and it does not work as the parent cannot access the child protected members. 

My question is who's got the OOP principles right here? I've read through the LSP but it doesn't seem concerned with parent classes, so is it correct for a parent to access child protected members (like PHP assumes it is) or should it be restricted (like C# assumes it should be)?

Answer: 
The way that C# restricts access seems to be the most logical way to do it.

A parent should not be able to inherit anything from a child. And without inheriting anything from the child, the parent should not have access to the child's protected methods.
PHP is a dynamically typed language. Function and method calls are not checked until that line of code is actually executed. In PHP you can have two objects instances from the same class with different methods. [This works fine.](https://stackoverflow.com/questions/2938004/how-to-add-a-new-method-to-a-php-object-on-the-fly) 

Statically typed languages like C# require to know the types of objects before execution. You can still [use reflection to call children methods from the parent](https://stackoverflow.com/questions/2202381/reflection-how-to-invoke-method-with-parameters), but you can't add new methods dynamically.