We provide IT Services

Register Now Click On

Read More Tutorials Click On

Post Page Advertisement [Top]


A Constructor not Parameterized is called a default Constructor.

Example of Default Construtor:-

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

namespace what_is_default_constructor
{
    class Rock
    {
        int a = 20, b = 60, c;

        public Rock()
        {
            c = a + b;
            Console.WriteLine(c);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Rock Rock1 = new Rock();
            Console.ReadKey();
        }
    }
}

No comments:

Post a comment

| Designed by Rockprogrammer