Can we declare destructor as static? Explain?
Answers were Sorted based on User's Feedback
Answer / murali
Yes we can. But you can't use it.
Use new to create the object.
At the same time you can't use delete.
Why can't : As destuctor uses 'this' context and in this
case it can't being static.
| Is This Answer Correct ? | 8 Yes | 2 No |
Answer / jaroosh
To sum up : you CANT declare destructor as static, as you
CANT declare constructor as static, both are responsible for
destroying and creating OBJECTS while static storage means
that methods/members do not belong to any objects but to the
whole class.
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / sunil
declaring destructor and constructor as static is a syntax error
| Is This Answer Correct ? | 2 Yes | 0 No |
What is different in C++, compare with unix?
Disadvantages of c++
What is algorithm in c++ programming?
What is c++ map?
Why do we use structure in c++?
Is c++ vector a linked list?
Can we use this pointer in a class specific, operator-overloading function for new operator?
Is c++ vector dynamic?
Should the member functions which are made public in the base class be hidden?
What is dynamic and static typing?
What is c++ coding?
how to swap two strings without using any third variable ?