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 |
Do inline functions improve performance?
Where can I run c++ program?
why and when we can declar member fuction as a private in the class?
What jobs can you get with a c++ certification?
Can we generate a C++ source code from the binary file?
How many characters are recognized by ANSI C++?
Can non-public members of another instance of the class be retrieved by the method of the same class?
What is the purpose of extern storage specifier?
What are the c++ access specifiers?
What are different types of polymorphism supported by C++
What do you mean by function pointer?
Which bit wise operator is suitable for putting on a particular bit in a number?