misty
01-12-2003, 07:33 PM
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
Plystire
01-12-2003, 07:40 PM
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 :confused:
~PlystirE~
Borgtex
01-12-2003, 09:33 PM
Javasccript programming isn't the appropiate forum for this question
santigoon
01-13-2003, 09:27 AM
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.
codefox
01-13-2003, 03:11 PM
Virtual constructors are just like virtual functions and are useful when there are derived classes. Refer to this thread for virtual functions: http://www.codingforums.com/showthread.php?threadid=12151
Destructors cannot be overloaded. Why would you want a destructor to be overloaded? They are not explicitly called, right?