C# Object and Class Example Having Main() in another class

C# Programming Language OOPS Concept (Article) OOPS Concept (Program)

208

Program:

// C# Object and Class Example Having Main() in another class

using System;  
   public class Student  
    {  
        public int id;   
        public String name;  
   }  
   class TestStudent{  
       public static void Main(string[] args)  
        {  
            Student s1 = new Student();    
            s1.id = 101;  
            s1.name = "Rambo Azmi";  
            Console.WriteLine(s1.id);  
            Console.WriteLine(s1.name);  
  
        }  
    } 

Output:

101
Rambo Azmi

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about C# Programming Language. Then you can visit below links to get more depth on this subject.