PROGRAM TO IMPLEMENT FUNCTION OVERRIDING

//PROGRAM TO IMPLEMENT FUNCTION OVERRIDING
class Base
{
void override( )
{
System.out.println(“I am in base class”);
}
}
class Derived extends  Base
{
void override( )
{
System.out.println(“I am overridden in derived class”);
}
}
class TestOverride
{
public static void main(String s[ ])
{
Base b=new Base( );
b.override( );

Derived d=new Derived( );
d.override( );
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *