5kyy8lu3 Posted March 15, 2010 Share Posted March 15, 2010 Hi. I'm slowly converting over to object oriented programming. I know it's good practice to use 'getter' and 'setter' methods to move data in and out of an object, but what about session variables? Do I really need to use a 'setter' method to get the value into my object? Thanks! Link to comment https://forums.phpfreaks.com/topic/195296-session-and-server-variables-and-classesobjects/ Share on other sites More sharing options...
trq Posted March 15, 2010 Share Posted March 15, 2010 Accessing globals within a class breaks encapsulation, so yes, you should be using getters and setters to set and get any data within an object. Link to comment https://forums.phpfreaks.com/topic/195296-session-and-server-variables-and-classesobjects/#findComment-1026282 Share on other sites More sharing options...
5kyy8lu3 Posted March 15, 2010 Author Share Posted March 15, 2010 thanks once again Link to comment https://forums.phpfreaks.com/topic/195296-session-and-server-variables-and-classesobjects/#findComment-1026350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.