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 |
How to stop conversions among objects?
Which is the best c++ compiler?
What problem does the namespace feature solve?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
Can you please explain the difference between using macro and inline functions?
Explain the scope resolution operator?
What is static class data?
How we can differentiate between a pre and post increment operators during overloading?
Explain bubble sorting.
What is prototype for that c string function?
Explain the advantages of using friend classes.
What is "mutable" keyword?