Constructor in c#
Question : What is the output of the below code?
using System;
using System.Text;
namespace ConsoleApplication1
{
class A
{
public A()
{
Console.WriteLine("A.Constructor");
}
public A(string abc)
{
Console.WriteLine("A.Constructor " + abc);
}
public void Show()
{
Console.WriteLine("A.Show()");
}
}
class B : A
{
public B() : base("Hello")
{
Console.WriteLine("B.Constructor");
}
public void Show()
{
Console.WriteLine("B.Show()");
}
}
class Program
{
static void Main(string[] args)
{
B obj = new B();
obj.Show();
Console.ReadLine();
}
}
}
Please comment your answer below...
Please comment your answer below...
Comments
Post a Comment