Why constructor and destructor cannot be made static?
The term "destructor" made me believe this question is related
to .Net languages.
A destructor is to destroy an instance of object. If it is
available at static/class level, what is it going to destroy? The
entire class, so the class no longer available? Thus, semantically,
destructor should be an instance method.
Constructor is on the opposite end of the life cycle of an
instance.
However, in .NET, a static constructor is allowed. Personally, I
call this static constructor as a class initialization method. This
method will be invoked by the .net framework only once when the
class is loaded into the application domain.
With the similar concept, there should be a "finalizer" of the
class when the class is unloaded out of the application domain. But
wait, does a class ever go out of the application domain once it's
loaded? Yes, only at the termination of the application! Currently
a class cannot be unloaded explicitly in codes and thus no point to
have a static finalizer.