6
If a class defines a constructor with parameters only, does C# still provide a default parameterless constructor?
DiscussEasy
Loading subject content…
Loading practice questions…
If a class defines a constructor with parameters only, does C# still provide a default parameterless constructor?
What is the output of the following program?
Console.WriteLine(new P().V);
class P {
public int V;
public P() : this(7) { }
public P(int v) { V = v; }
}What is the output of the following program?
Console.WriteLine(Config.Name);
static class Config
{
public static string Name;
static Config() { Name = "ready"; }
}