If a class contains no constructor declarations, a default constructor is automatically provided. The default constructor is always of the form
public C(): base() {}
where C
is the name of the class. The default constructor simply invokes the parameterless constructor of the direct base class. If the direct base class does not have an accessible parameterless constructor, an error occurs. In the example
class Message { object sender; string text; }
a default constructor is provided because the class contains no constructor declarations. Thus, the example is precisely equivalent to
class Message { object sender; string text; public Message(): base() {} }