Results 1 to 5 of 5

Thread: abstract classes and session_start

Hybrid View

  1. #1
    Join Date
    Dec 2010

    abstract classes and session_start

    Something like:



    gives the error;

    "cannot instantiate abstract class AbstractClass ......"

    What is the mechanism invloved here, please?

  2. #2
    Join Date
    Aug 2004
    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.)
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Dec 2010

    thanks but.

    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..

  4. #4
    Join Date
    Dec 2010


    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!!!!

  5. #5
    Join Date
    Sep 2010
    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 10:38 AM. Reason: first explanation was way too involved :)
    Quint Jensen
    Web Developer
    Scaled Solutions

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center