class Base
{
/*public */
static Base() //Access specifier not allowed for static constructor
{
Console.WriteLine("Base Static");
}
public Base()
{
Console.WriteLine("Base Constructor");
}
}
class Child :Base
{
/*public */
static Child() //Access specifier not allowed for static constructor
{
Console.WriteLine("Child Static");
}
public Child()
{
Console.WriteLine("Child Constructor");
}
}
public class MainClass
{
public void Show()
{
Child objChild = new Child();
//Output
// Child Static
//Base Static
//Base Constructor
//Child Constructor
}
}
{
/*public */
static Base() //Access specifier not allowed for static constructor
{
Console.WriteLine("Base Static");
}
public Base()
{
Console.WriteLine("Base Constructor");
}
}
class Child :Base
{
/*public */
static Child() //Access specifier not allowed for static constructor
{
Console.WriteLine("Child Static");
}
public Child()
{
Console.WriteLine("Child Constructor");
}
}
public class MainClass
{
public void Show()
{
Child objChild = new Child();
//Output
// Child Static
//Base Static
//Base Constructor
//Child Constructor
}
}
No comments:
Post a Comment