April 20, 2010

JavaScript Question

Q1. Disbable back option by java script
Ans.    window.history.go(+1) use in java script;
         or
onunload =window.history.go(-1) in body tag

Q2. we can disable the right click using 
Ans. <body oncontextmenu="return false">
</body>

Virtual functions in C#

Virtual functions implement the concept of polymorphism are the same as in C# except that you use the override keyword with the virtual function implementaion in the child class. The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.

class Shape
{
    public virtual void Draw()
    {
        Console.WriteLine("Shape.Draw") ;
    }
}


class Rectangle : Shape
{
    public override void Draw()
    {
        Console.WriteLine("Rectangle.Draw");
    }
}