AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


Overloading

      Overloading provides the ability to create multiple methods or properties with the same
name, but with different parameters lists. This is a feature of polymorphism. A simple
example would be an addition function, which will add the numbers if two integer
parameters are passed to it and concatenate the strings if two strings are passed to it.

Example:-
using System;
public class test
{
    public int Add(int a , int b)
    {
        return(a + b);
    }
    public string Add(String a, String b )
    {
        return (a + b);
    }
    public static void Main()
    {
        test x = new test ();
        int y;
        String z;
        y = x.Add(1, 2);
        z = x.Add("Merbin", " Joe");
        Console.WriteLine(y);
        Console.WriteLine(z);
    }
}

Output:-
3
Merbin Joe

Overriding

      Class inheritance causes the methods and properties present in the base class also to be
derived into the derived class. A situation may arise wherein you would like to change
the functionality of an inherited method or property. In such cases we can override the
method or property of the base class. This is another feature of polymorphism.

Example:-
public abstract class sample
{
    public abstract void display()
    {
        Console.WriteLine("Sample");
    }
}
public class square: sample
{
    public override void display()
    {
        Console.WriteLine("This is a square");
    }
}
public class rectangle:sample
{
    public override void display()
    {
        Console.WriteLine("This is a rectangle");
    }
}




Advertisement

0 comments:

Post a Comment

Total Pageviews