Answer: No, a "
struct " cannot contain a parameter-less constructor or default constructor. The default constructor is implicit for all structures and cannot be overridden. It simply sets all of the fields in the structure to their default values.
For example :-
struct st
{
public st()
{
}
string name;
public st(string name)
{
this.name = name;
}
}
Try to compile the above code and you will get an error like below:-
Structs cannot contain explicit parameterless constructors
|
Alert Moderator