using System;
public class HelloWorld
{
public static void Main(string[] args)
{
A obja=new B();
obja.Method();
}
}
public class A{
static A(){
Console.WriteLine("construct static A");
}
public A(){
Console.WriteLine("construct default A");
}
public void Method(){
Console.WriteLine("called method of A");
}
}
public class B : A
{
static B(){
Console.WriteLine("construct static B");
}
public B(){
Console.WriteLine("construct default B");
}
public void Method(){
Console.WriteLine("called method of B");
}
}
Output :
construct static B
construct static A
construct default A
construct default B
called method of A
0 Comments:
Post a Comment