static void Main(string[] args) { Console.WriteLine("--------------------------------------------"); Console.WriteLine("Check if a Given Year is a Leap Year"); Console.WriteLine("--------------------------------------------"); Console.WriteLine("\n"); // The LeapYear() constructor is the default constructor created // implicitly by C# which sets the member variables to the default // values. The method possesses the same name as the class. LeapYear obj = new LeapYear(); // The expressions below invoke the ReadData and Leap methods and // passes a copy of the address of the class instance 'obj' to the methods // rather than the instance itself since a class is a reference type // The methods then return the data to the instance 'obj' created // in the constructor and save it to memory. // Renamed the method names using Pacal case per the .NET conventions obj.ReadData(); obj.Leap(); }
static void Main(string[] args) { LeapYear.Leap(); Console.Read(); }