448191 Posted February 11, 2008 Share Posted February 11, 2008 Fatal error: Call to private Backbone_Data_TransferObject_Abstract::__construct() from context 'Backbone_Data_TransferObject_Abstract' in J:\John\Sites\Library\Backbone\Data\TransferObject\Abstract.lib on line 12 Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 11, 2008 Share Posted February 11, 2008 Super Private! Quote Link to comment Share on other sites More sharing options...
448191 Posted February 11, 2008 Author Share Posted February 11, 2008 Already found the cause, I was being stupid. Although you have to admit, that message confuses the hell out of you if don't know what's causing it. Basically I have this supertype, with a private constructor (stupid stupid stupid) and a factory method. The factory method has access to the supertype's constructor, but the subtype does not and can not inherit it, since it is private. Since we never left the scope of the supertype, we end up with this peculiar, but correct, error message. Quote Link to comment Share on other sites More sharing options...
GameYin Posted February 11, 2008 Share Posted February 11, 2008 ??? :'( ALL at once Quote Link to comment Share on other sites More sharing options...
neylitalo Posted February 11, 2008 Share Posted February 11, 2008 Is there ever a situation where you'd want to make a constructor private? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 11, 2008 Share Posted February 11, 2008 Is there ever a situation where you'd want to make a constructor private? For instance if you are creating a singleton and wish to restrict instantiation. In that way you can ensure that it will only be instantiated from within the class. Quote Link to comment Share on other sites More sharing options...
neylitalo Posted February 11, 2008 Share Posted February 11, 2008 Ah, yes. And then have a getInstance method to handle the first instantiation, right? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 11, 2008 Share Posted February 11, 2008 Yes, the first and only instantiation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.