luigi Posted April 1, 2018 Report Posted April 1, 2018 Hi Thanks for the great tutorial! In medias res - just the way I like it. I thought I'd post questions as they come up, for a starter here's this: "Another convention is that getter and setter names should match the property names" Is this really just a convention or the class would not work at all otherwise? In other words do I need "var $name;" in order to set (and get) the value of "$this->name"? Quote
luigi Posted April 1, 2018 Author Report Posted April 1, 2018 (edited) ... Edited April 1, 2018 by luigi double post Quote
luigi Posted April 1, 2018 Author Report Posted April 1, 2018 I continue echo "Tell me private stuff: ".$stefan->pinn_number; Hey you said direct accessing is a no-go! But I understand it's for the sake of visualization of access errors - which brings the next question: even though $pinn_number is a private property I can display it with a public get method on index.php which, according to my understanding, is outside the class. I thought for this I should do sg like copying the private property value to a public property (e.g. "$pub_pinn") but looks like I can do without. What am I missing here? Quote
luigi Posted April 1, 2018 Author Report Posted April 1, 2018 This is just a remark, step 18 and 19 has the same code. The former - I guess - should be: $this->name = $employee_name; Quote
administrator Posted April 2, 2018 Report Posted April 2, 2018 On 4/1/2018 at 8:25 AM, luigi said: Is this really just a convention or the class would not work at all otherwise? It is just a convention. Just try the code. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.