Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Why we use static before instantiating a class

$
0
0

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

namespace Construct
{
    class Program
    {
public static Base b = new Base();
        static void Main(string[] args)
        {
            b.add();
        }
    }

    public class Base
    {
        public void add()
        {
            Console.WriteLine("I Invoked");
        }
    }
}

I am a beginer in programming.....

In this case the bolded font....can any one explain the use of "static" keyword  while instantiating a class (keep reference variable as  stataic....what is the use and which scenario we use this) or its working details....plzzzz

       




Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>