Experiment Four
1. Create a person class that contains three attribute name,age,wealth, set to public,private,protected, and then define subclass student of the person class.
2. Refer to these three properties in PHP code, a. Used in the person class, B. Outside the person class, C. Used in the subclass student class of the person class. Can not be used properly in these three places? If there is an error, please indicate the error and the cause of the error.
3. Add two methods to the person class above, eat () and consume (), write the test statements, and call both methods in the code. Join the Call Walk () method in the test statement, what are the error hints? How do I fix it? Tip Use magic put __call () to give a friendly hint.
4, in the 2nd question, we are outside the person class directly using the private property is wrong, then what method can be used, without errors? Tip: Magic Methods __set () and __get () methods, add both methods for this class of person. and test that there are no errors in referencing private properties outside of the person class.
5. Test other magic methods, __isset () and __unset ()
PHP Experiment 4