Originally posted by fandelem
I believe the concept behind OOP is that you want to create functions in your base (or "super") class that access its variables. This way if you change the variable name, your getField() across 40 different applications will still function properly... and so it goes..
Yes but what if the getField() in the base class changes as well?
for example, let's say the member var in the bass class is $myVar, and has associated accessor function: get_myVar(). So in my subclass, I use:
$something = $this->get_myVar();
Then later, the base class is changed and the $myVar memeber is removed all together (Along with it's accesor function get_myVar()). Now, if I instaitate my subclass, I'm going to start getting "Call to undefined function get_myVar()" errors. If I've used get_myVar extensively in the subclasses in my 40 different applications, I'm in big trouble and I have alot of work to do in order to make all my subclasses work again.