<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Great work]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=23&amp;type=atom"/>
	<updated>2011-02-10T14:02:44Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=23</id>
		<entry>
			<title type="html"><![CDATA[Great work]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=72#p72"/>
			<content type="html"><![CDATA[<p>Hello,</p><p>I just discovered Maratis, and I am really impressed. You did a really great work.<br />I&#039;ll try to use it in a really near futur.</p><p>One suggestion: wouldn&#039;t it be better if you implement your singleton in a more secured way ?<br />I mean:<br /> - Have the constructor private.<br /> - Have a static instance set to null and instantiate it if needed.</p><p>A short sample:</p><p>In<br />class SingleObject<br />{<br />private:<br />&nbsp; static SingleObject*_instance;</p><p>private:<br />&nbsp; &nbsp; // Constructor/Destructor<br />&nbsp; &nbsp; SingleObject();<br />&nbsp; &nbsp; ~SingleObject();</p><p>public:<br />&nbsp; &nbsp; static SingleObject* getInstance ()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; if (NULL == _instance)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_instance =&nbsp; new SingleObject;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return _instance;<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; static void kill ()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; if (NULL != _instance)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delete _instance;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _instance = NULL;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />};</p><p>In the .cpp file<br />SingleObject *SingleObject::_instance = NULL;</p><p>I think it&#039;s a better way to implement the singleton pattern, but it&#039;s just my opinion.</p><p>Great work, and best regards.</p>]]></content>
			<author>
				<name><![CDATA[LaBigne]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=31</uri>
			</author>
			<updated>2011-02-10T14:02:44Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=72#p72</id>
		</entry>
</feed>
