Re: Protected methods in interfaces

From: Date: Thu, 05 Aug 2004 18:23:16 +0000
Subject: Re: Protected methods in interfaces
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-11947@lists.php.net to get a copy of this message
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

« previous php.internals (#11947) next »