I just want explain the concept of static with real world example in a simple way.
Let’s create Student class as below,
- class Student
- {
- public int StudentId
- {
- get;
- set;
- }
- public string StudentName
- {
- get;
- set;
- }
- public string StudentClassName
- {
- get;
- set;
- }
- public string HeadMasterName
- {
- get;
- set;
- }
- }
- StudentId - Represent student registration number\
- StudentName - Represent student name
- StudentClassName - Represent student class in which he/she studying
- HeadMasterName - Represent Head Master of the student
We create the individual student by using following function.
- public void getStudentInfo()
- {
- Console.WriteLine("Enter the student details(StudentId,StudentName,StudentClassName,HeadMasterName)");
- StudentId = Convert.ToInt32(Console.ReadLine());
- StudentName = Console.ReadLine().ToString();
- StudentClassName = Console.ReadLine().ToString();
- HeadMasterName = Console.ReadLine().ToString();
- }

Join the conversation! Your thoughts help the community grow.