<div class="gmail_quote">On Tue, Jul 10, 2012 at 3:39 PM, David Lonie <span dir="ltr"><<a href="mailto:david.lonie@kitware.com" target="_blank">david.lonie@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Jul 10, 2012 at 3:25 PM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
> Why are the static New methods of singleton objects in VTK public?<br>
>   static vtkMathTextUtilities *New();<br>
<br>
</div>That New method just returns the singleton instance after increasing<br>
its reference count. Not sure exactly why it was included (the<br>
original author of the vtkFreeTypeUtilities pattern may), but I like<br>
having it around for use with vtkNew/vtkSmartPointer. I think the VTK<br>
user guide also says that all vtkObject subclasses _must_ define it.<br></blockquote><div><br></div><div>Right, but I phrased it strangely. My real question was "does static New have to be in the public section of the class"?</div>
<div><br></div><div>(For a singleton that is created via a call to GetInstance, isn't it a good idea to make "New" protected or even private?)</div><div><br></div><div>Maybe it does need to be public for the wrappers or something, but seems like a bad idea to have a public New for a singleton.</div>
<div><br></div></div>