Static Destructor

Why we use static destructor? What is its scope and What is its implementation?

Questions by charu aggarwal

Showing Answers 1 - 3 of 3 Answers

  • Nov 7th, 2011
 

You cannot declare destructor as static.
Destructors cannot be declared const, volatile, const volatile or static.

Refer:
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr380.htm

static ~Sample()
{
std::cout<<"Destructor
";
}
The above code snippet shows following error.
error C2574: 'Sample::~Sample(void)' : cannot be declared static

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions