We provide IT Services

Register Now Click On

Read More Tutorials Click On

Post Page Advertisement [Top]


A constructor is passing the argument is called Parametureid constructor.

Example of  Parameterized constructor

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

namespace What_is_Parameterized_Constructor
{
    class Devesh
    {
        int a, b;
        public Devesh(int X, int Y)
        {
            a = X;
            b = Y;
        }
        static void Main(string[] args)
        {
            Devesh dd = new Devesh(500, 1500);
            Console.WriteLine("Print the value X:" +dd.a);
            Console.WriteLine("Print the value Y:" + dd.b);
            Console.ReadKey();
        }
    }
}

output:-

No comments:

Post a Comment

| Designed by Rockprogrammer