default type initializers?

  • Thread starter Thread starter ex-neo-con
  • Start date Start date
E

ex-neo-con

Does the clr create a default type initializer if an explicit one isn't
implemented for a type? (In other words, is type creation analogous to
the instantiation of a class for which a default constructor hasn't
been written?)

ex-neo-con
 
ex-neo-con said:
Does the clr create a default type initializer if an explicit one isn't
implemented for a type? (In other words, is type creation analogous to
the instantiation of a class for which a default constructor hasn't
been written?)

Structs always have public parameterless type initializers, and their
behaviour can't be specified.

For classes, if *no* constructors have been declared, a default one is
provided. I personally *only* use the term "default constructor" for
one which is created by the compiler, referring to one which is
declared in the source code just as a public parameterless constructor.
 
Back
Top