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 |
program explaining feautures of c++
What is the use of lambda in c++?
What is size of Empty Class?
What do you mean by function and operator overloading in c++?
How do you link a C++ program to C functions?
What is difference c and c++?
what are Access specifiers in C++ class? What are the types?
Define whitespace in C++.
What is the difference between while and do while loop?
Define copy constructor.
What is the handle class?
What's the order in which the objects in an array are destructed?