I would like to prevent a child class from redeclaring some parent’s attributes.
How can I do that?
EDIT: If my parent class has a “title” property, i don’t want that children can (re)declare property with this name
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
i’m not sure if this will work but you could try playing with the Reflection class and detect if any child has redeclared the property and then fire an exception or something
UPDATE:
check this links out:
http://www.php.net/manual/en/reflectionproperty.getdeclaringclass.php
and
http://www.php.net/manual/en/reflectionproperty.setaccessible.php
It should help