(12-02-2016, 08:40 AM)Narf Wrote: If you want to use inheritance - that's its whole purpose.
It can be argued whether inheritance is good in the first place, but since you pretty much can't get without it in CodeIgniter, that's a moot point.
I'm new to OOP and CI and I have two questions here:
1. Is it better to access "$data" the OOP way ("$this->data") as in muuuchos example or should I access it by "$data" as the CI documentation does, and are the two ways technically equivalent?
2. Then a basic question about inheritance. Lets say I have a class "Car" that inherits "MY_Controller". Should I access "$data" (or "$this-data") direct or is it better to declare it "private" in "MY_Controller" and then use getter and setter functions? In other words: is it good practice to use data encapsulation when you want to access data from a class that you inherit from?