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 are the differences between public, private, and protected access?
12 Answers IBM, Oracle, Wipro,
There is a array of 99 cells and we have to enter 1-100 elements in it , no two elements would repeat , so the is one no. missing because 99 cells and 1-100 nos. so we had to implement a function to find that missing no.
What is a terminating character in c++?
Can I learn c++ in a week?
What is a class template?
Is c++ used anymore?
What is string in c++ programming?
What is setf in c++?
Explain the uses of static class data?
Difference between inline functions and macros?
In java a final class is a class that cannot be derived. How can you make a similar class in C++
How much maximum can you allocate in a single call to malloc()?