abstract classes and session_start
gives the error;
"cannot instantiate abstract class AbstractClass ......"
What is the mechanism invloved here, please?
Sounds like something in the code is trying to instantiate an abstract class (duh! ). So, look for something in the code (including in the included file) that does "new AbstractClass()". (You can only create objects from any concrete child classes of an abstract class, not the abstract class itself.)
Thank you both for your replies but I didn't phrase my question very well. These (or similar) are the first 2 lines of the code.
It seems as if session_start() is trying to instantiate the class. If I remove this it goes on OK. What I really need to know is why session_start() should be behaving like this as I have session variables to pass to the next page..
Just realised why!! Thanks for replying.
It wasn't an abstract class to start with but I've just subclassed it. Forgot to remove the constructor!!!!
It looks like you are requiring an abstract class and when the session starts, something is trying to create an instance of the abstract class. It isn't possible to create an instance of an abstract class directly, so you get the error. If you want to use an abstract class, create a child class of the abstract class and create an instance of the child class.
Last edited by qjensen; 12-17-2010 at 09:38 AM.
Reason: first explanation was way too involved :)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread