0% found this document useful (0 votes)
15 views1 page

Constructor in Inheritance in C# Code

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Constructor in Inheritance in C# Code

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Constructor_In_Inheritance
{

class BaseClass
{
public BaseClass(string message)
{
Console.WriteLine(message);
}
public BaseClass(int i)
{
Console.WriteLine(i);
}

class DerivedClass : BaseClass


{
public DerivedClass() : base(25)
{
Console.WriteLine("this is a constructor of Derived class !!");

class Program
{
static void Main(string[] args)
{
DerivedClass dc = new DerivedClass();
Console.ReadLine();
}
}
}

You might also like