I am trying to understand some code for my programming exam and I've stumbled upon this notation that I can't seem to find the explanation for. I've searched stackoverflow, msdn and several online tutorials, but no luck.
The code is something like this:
class A
{
public A(): this("b")
{
Console.WriteLine("c");
}
public A(string i)
{
Console.WriteLine(i);
}
}
class B : A
{
public B()
{
Console.WriteLine("a");
}
---------------
static void Main(string[] args)
{
A b = new A();
}
}
This, supposedly, prints out "bc", but I can't even understand the inheritance and all. I can't find out what is this notation here does:
public A(): this("b")
{
Console.WriteLine("c");
}
The only thing I found that looked remotely similar are object initializers, but only in one online tutorial. Checked MSDN for them - no similar code. Anyone able to help? Thanks in advance!