Overriding

Unknown | 2:36 AM |

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.


public abstract class shapes
{
public abstract void display()
{
Console.WriteLine("Shapes");
}
}
public class square: shapes
{
public override void display()
{
Console.WriteLine("This is a square");
}
}
public class rectangle:shapes
{
public override void display()
{
Console.WriteLine("This is a rectangle");
}
}

Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....