static void Main() { //Class1.Display() You can not colled that class1 o; // o is a reference of type Class1 o = new class1(); // Allocate memory for an object of type Class1 and make o point to it //class1 o = new class1(); o.Display(); o.Display("Rahul"); //Positional parameters Console.WriteLine(o.Add(10, 20, 30, 40)); Console.WriteLine(o.Add(10, 20, 30)); Console.WriteLine(o.Add(10, 20)); Console.WriteLine(o.Add(10)); Console.WriteLine(o.Add()); // Named Parametsre Console.WriteLine(o.Add(d: 40)); Console.WriteLine(o.Add(c: 30)); Console.WriteLine(o.Add(d: 40, c: 30)); //Add2 //Console.WriteLine(o.Add2(d: 40)); Console.WriteLine(o.Add2(d: 40, a: 40, b: 40, c: 40)); Console.ReadLine(); }
static void Main() { // class1 o; // o is a ref of type Class1 // o = new class1(); // allocate memory for an obj of type class1 and make to point to it. class1 o = new class1(); o.Display(); o.Display("Shradha"); // positional parameters Console.WriteLine(o.Add(10, 20, 30, 40)); Console.WriteLine(o.Add(10, 20, 30)); Console.WriteLine(o.Add(10, 20)); Console.WriteLine(o.Add(10)); Console.WriteLine(o.Add()); Console.WriteLine(); //named parameters Console.WriteLine(o.Add(d: 40)); Console.WriteLine(o.Add(c: 30)); Console.WriteLine(o.Add(d: 40, c: 30)); //Console.WriteLine(o.Add2(d: 40)); // Error //Console.WriteLine(o.Add2(a: 30)); // Error Console.WriteLine(o.Add2(d: 40, c: 30, a: 40, b: 30)); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); #region method and Prop Calls //Console.WriteLine("Error"); class1 o = new class1(); //---------------------------------------------- //o.display(); //o.display("Some String"); //Console.WriteLine(o.add(10,20)); //------------------------------------------------ //--------------------------------------------- //o.setI(155); //Console.WriteLine(o.getI()); //----------------------------------------- //o.Prop1 = 99; //Console.WriteLine(o.Prop1); #endregion o = null; GC.Collect(); // Console.ReadLine(); }
static void Main(string[] args) { class1 o = new class1(); o.display(); o.display("Shankar"); Console.WriteLine(o.add(10, 20, 30, 40)); Console.WriteLine(o.add(10, 20, 30)); Console.WriteLine(o.add(10, 20)); Console.WriteLine(o.add(10)); Console.WriteLine(o.add()); Console.WriteLine("================="); // Named Parameters Console.WriteLine(o.add(d: 40)); Console.ReadLine(); }