overriding method (runtime poly)

PHOTO EMBED

Tue Jan 09 2024 18:34:29 GMT+0000 (Coordinated Universal Time)

Saved by @E23CSEU1151 #java

class shape 
{
    void draw()
    {
        System.out.println("can't say about shape");
    }
}
class square extends shape
{
    @Override
    void draw()
    {
        super.draw();
        System.out.println("shape is square");
    }
}
class B
{
    public static void main(String[] args)
    {
        shape r=new square();
        r.draw();
    }
}
content_copyCOPY