<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Singletons, Sub-Classing, and HAS-A Relationships</title>
	<atom:link href="http://www.justincarmony.com/blog/2008/12/03/php-singletons-sub-classing-and-has-a-relationships/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justincarmony.com/blog/2008/12/03/php-singletons-sub-classing-and-has-a-relationships/</link>
	<description>Web Designer &#38; Software Engineer</description>
	<lastBuildDate>Tue, 15 May 2012 02:22:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Justin Carmony</title>
		<link>http://www.justincarmony.com/blog/2008/12/03/php-singletons-sub-classing-and-has-a-relationships/comment-page-1/#comment-9747</link>
		<dc:creator>Justin Carmony</dc:creator>
		<pubDate>Tue, 16 Dec 2008 14:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/?p=298#comment-9747</guid>
		<description>Thanks for the question Timmy. 

The reason for &quot;static private $_instance&quot; is for several reasons. 

First, I declare it static so that the variable is the same across any and all instances of this class. It is important because I use a static method to retrieve this value. Static methods do not have access to &quot;$this&quot;. 

Second, the private is to ensure that the only manipulation done to the $_instance variable is by the CurrentUser class. By declaring it private, only functions withint the CurrentUser class have access to it. Outside I couldn&#039;t do &quot;CurrentUser::$_instance;&quot; to retrieve the object. You only can access it through the GetInstance function. This helps safe-guard against developers on accidentally breaking functionality. 

I hope this helps.</description>
		<content:encoded><![CDATA[<p>Thanks for the question Timmy. </p>
<p>The reason for &#8220;static private $_instance&#8221; is for several reasons. </p>
<p>First, I declare it static so that the variable is the same across any and all instances of this class. It is important because I use a static method to retrieve this value. Static methods do not have access to &#8220;$this&#8221;. </p>
<p>Second, the private is to ensure that the only manipulation done to the $_instance variable is by the CurrentUser class. By declaring it private, only functions withint the CurrentUser class have access to it. Outside I couldn&#8217;t do &#8220;CurrentUser::$_instance;&#8221; to retrieve the object. You only can access it through the GetInstance function. This helps safe-guard against developers on accidentally breaking functionality. </p>
<p>I hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timmy</title>
		<link>http://www.justincarmony.com/blog/2008/12/03/php-singletons-sub-classing-and-has-a-relationships/comment-page-1/#comment-9743</link>
		<dc:creator>Timmy</dc:creator>
		<pubDate>Tue, 16 Dec 2008 11:03:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/?p=298#comment-9743</guid>
		<description>I dont think that &quot;static private $_instance = null;&quot; is good idea. Why is private for, if you could access from outside, like self::$_instance? It&#039;s not private then. Why you are not using $_instance variable as static in your GetInstance function?</description>
		<content:encoded><![CDATA[<p>I dont think that &#8220;static private $_instance = null;&#8221; is good idea. Why is private for, if you could access from outside, like self::$_instance? It&#8217;s not private then. Why you are not using $_instance variable as static in your GetInstance function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross Scrivener</title>
		<link>http://www.justincarmony.com/blog/2008/12/03/php-singletons-sub-classing-and-has-a-relationships/comment-page-1/#comment-9413</link>
		<dc:creator>Ross Scrivener</dc:creator>
		<pubDate>Wed, 03 Dec 2008 08:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/?p=298#comment-9413</guid>
		<description>Good stuff! Well written up, I&#039;ve used a &quot;registry&quot; class in the past so I could store all kinds of data in one class rather than have lots of classes that effectively do nothing, but I guess both methods have their plus points.</description>
		<content:encoded><![CDATA[<p>Good stuff! Well written up, I&#8217;ve used a &#8220;registry&#8221; class in the past so I could store all kinds of data in one class rather than have lots of classes that effectively do nothing, but I guess both methods have their plus points.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 15/19 queries in 0.006 seconds using memcached
Content Delivery Network via Rackspace Cloud Files: c747925.r25.cf2.rackcdn.com

Served from: www.justincarmony.com @ 2012-05-17 23:13:09 -->
