Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: c++

  1. #1
    New to the CF scene
    Join Date
    Nov 2002
    Location
    nagpur
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question c++

    1.In c++,i know virtual destructors but what is virtual constructor
    & where,why is it used

    2.why constructors r overloaded & not destructors



    thanks in advance

  • #2
    New Coder
    Join Date
    Jan 2003
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well...i always thought CONstructors were things that BUILT things and DEstructors were ones that destroyed 'em.

    so maybe you can have an overload of built things but you can destroy things until everythings gone which is prolly why constructors overload and destructors don't

    ~PlystirE~
    CHAOS! DISORDER! MAYHEM!
    My job here is obviously done.
    ~ Plystire

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Javasccript programming isn't the appropiate forum for this question
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #4
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    C++ and Javascript

    Contrary to C++, Javascript does not have inheritance, or explicit destructors.

    A constructor creates a new instance. It is customary to use functionnames as classnames. So function MyClass(){return this}, returns an instance of MyClass.

    No function is called on destruction.

    Javascript is prototype based.

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Location
    India
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Virtual constructors are just like virtual functions and are useful when there are derived classes. Refer to this thread for virtual functions: Overridable

    Destructors cannot be overloaded. Why would you want a destructor to be overloaded? They are not explicitly called, right?


  •  

    Posting Permissions

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