Hello Ferdinand,

Thursday, August 5, 2004, 8:07:05 PM, you wrote:

> On 5 Aug 2004 at 13:59, George Schlossnagle wrote:

>> >   Can abstract methods be protected?
>> 
>> No.

> Why not? Look at my singleton example...

Even your protected __construct can be overwritten and made public again.
So you'd need a private __construct in your interface. Also the pattern
singleton requires at least one static proected or private member variable
and a little bit code in function getInstance(). Having said this the
only way to do what you are trying to do is using templates in c++ or
compareable elements of other languages fully supporting functional
programming. Having saif this and looking back at what you can do is
defining the access interface to your singletons. Thus the interface
would reduce to:

interface Singleton {
  function getInterface();
}

So as usually with interfaces you have to fully implement the functionality
behind that interface every time it is realized.


Best regards,
 Marcus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to