Access Level to certain class must be public error in PHP

前端 未结 5 1577
猫巷女王i
猫巷女王i 2021-01-17 18:21

I created this class



        
5条回答
  •  花落未央
    2021-01-17 19:04

    As others have mentioned, you can't make a sub class method more restrictive than the parent; this is because sub classes are supposed to be a valid replacement for their parent class.

    In your particular case, I would change the visibility of all methods and properties that start with an underscore to protected.

提交回复
热议问题