54
1
using System;
2
3
public class Program
4
{
5
public sealed class Student
6
{
7
// Stores the single instance if this class.
8
private static Student oStudent;
9
10
// Returns the single instance of this class.
11
public static Student GetInstance()
12
{
13
if(oStudent == null)
14
{
15
oStudent = new Student();
16
}
17
18
return oStudent;
19
}
20
21
// Constructor declared private.
22
private Student()
23
{
24
//Initialization here
Cached Result