Announcement

Collapse
No announcement yet.

Con/Destruct Parameters?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Con/Destruct Parameters?

    Hi all,

    I was wondering if there exists a way to pass parameters to the Con/Destruct special Class Methods...
    JADT

  • #2
    No.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      All PowerBASIC objects are COM-compatible. That makes it very easy to have a single format and a single set of definitions for internal and external objects. COM objects do not allow parameters for constructors and destructors.

      Best regards,

      Bob Zale
      PowerBASIC Inc.

      Comment


      • #4
        Perhaps I am just reminding you of what you already know, but I'll post it for the benefit of those who might be new to OOP

        I am assuming you need to do some initialization and/or clean up work, correct? Right off the top of my head here are 2 ways of doing it:



        1) Create your own Initialize and Cleanup Methods and so you can do your initialization/cleanup work there instead. Consider having a read only property called "Initialized" which will tell anyone using your object if the object is ready to be used. If the property is not true, throw an error and let them know that the object is not ready to be used because it hasn't been initialized.

        If the object has to, 100%, clean up after itself even after a catastrophic system crash, you can use the same idea for your Cleanup Method and ensure than nothing, short of someone smashing the system with a sledgehammer, can stop your system from working the way it was designed to work.

        2) Use Ini files, Registry and database with the default constructor/destructor.


        I prefer #1.

        Your thoughts?

        Comment

        Working...
        X