public Spiderman(int age, int height, int weight, string firstName, string lastName, float webAmount, int speed, int power, FavouriteColor color) : base(age, height, weight, firstName, lastName) { WebAmount = webAmount; Speed = speed; Power = power; FavColor = color; }
static void Main(string[] args) { Human man = new Human(25, 80, 180, "Peter", "Parker"); Human women = new Human(18, 75); Human nomen = new Human(); man.smileyFace(); women.smileyFace(); // nomen.smileyFace(); Spiderman spidie = new Spiderman(25, 80, 180, "Spider", "Man", 100, 80, 100, FavouriteColor.blue); Console.WriteLine("Spidermans' age = " + spidie.Age.ToString()); ChangeSpidieAge(spidie, 50); Console.WriteLine("Spidermans' age = " + spidie.Age.ToString()); FavouriteColor colors = FavouriteColor.white; switch (colors) { case FavouriteColor.red: break; case FavouriteColor.white: break; case FavouriteColor.blue: break; case FavouriteColor.black: break; case FavouriteColor.brown: break; case FavouriteColor.pink: break; default: break; } Console.ReadKey(); }
static void Main(string [] args) { #region Enum Examples Weekdays day = Weekdays.Wed; Months month = Months.Oct; FavouriteColor myColor = FavouriteColor.Orange; #endregion #region Collection Examples int[] schoolMarks; int[] marks = new int[9]; int[] enggMarks = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int[] dacMarks = new int[] { 1, 2, 3, 4, 5, 6, 7, 9 }; string [] names = new string[] { "Ravi", "Akash", "Tanmay", "Gouri", "Asmita" }; List <string> students = new List <string>(); students.Add("Amitabh"); students.Add("Rajesh"); students.Add("Ramesh"); students.Add("Ganesh"); List <Person> people = new List <Person>(); people.Add(new Person("Ravi", "Tambade", new DateTime(1975, 08, 18))); people.Add(new Person("Sameer", "Nene", new DateTime(1995, 08, 8))); people.Add(new Person("Rajiv", "Gu[ta", new DateTime(1993, 03, 8))); foreach (Person prn in people) { Console.WriteLine(prn); } #endregion Console.WriteLine("{0}", day); #region MultipleViewNames ViewNames("Rahul Sir", "Bakul Madam", "Shrinivas Sir"); ViewNames("Jeevan", "Sangita"); ViewNames("Rahul Sir", "Bakul Madam", "Shrinivas Sir", "Rajesh", "Jay"); #endregion int mumbaiPopulation = 45000; int punePopulation = 3400; Swap(ref mumbaiPopulation, ref punePopulation); float area; float circum; float radius = 4; Calculate(radius, out area, out circum); Console.WriteLine("Area = {0}", area); Console.WriteLine("Circumference= {0}", circum); Console.ReadLine(); }