You are on page 1of 1

using System;

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

namespace private_constructer
{
internal class Program
{
public class counter
{
private counter()
{
}
public static int currentview;
public static int visitCount()
{
return ++ currentview;
}
}

class viewcounterdetails
{
static void Main()
{
Console.WriteLine("Private constructor");
Console.WriteLine();
counter.currentview = 500;
counter.visitCount();
Console.WriteLine("Now the view count is:{0}",counter.currentview);
Console.ReadLine();
}
}
}
}

OUTPUT :

You might also like