C# Program using parameterized constructor
In this program, You will learn how to implement parameterized constructor in C#.
public Test(int){
//statement
}
Example: How to implement parameterized constructor in C#.
using System;
public class Test
{
public Test(int x)
{
Console.WriteLine("Parameterized constructor is called here:" + x);
}
public static void Main(string[] args)
{
Test test = new Test(10);
}
}
Output:
Parameterized constructor is called here:10