Difference between dynamic casting and using "virtual" method in base class

If we want to access the derived class method using base class handle, we can do this by defining base class method as virtual but while i am looking at the “dynamic casting” concept this is also doing the same thing. so, I am confused whether both are serving same purpose and does both are the example of polymorphism definition?
Can someone explain the difference between both using simple example?
Thanks in advance.

In reply to Harshad:

Dynamic casting is not an example polymorphism because it requires prior knowledge of a class extension to perform the cast.

In reply to dave_59:

In reply to Harshad:
Dynamic casting is not an example polymorphism because it requires prior knowledge of a class extension to perform the cast.

Thanks Dave for quick reply!!!, but can you please explain this with some example?

In reply to Harshad:

Here is an example without virtual methods using dynamic cast. Look specificaly at the code in somefunc. Think about what you would have to do if class A was extended multiple times.

module top;
  
class A;
 rand int member1;
 function void printme1;
   $display("member1 ",member1);
 endfunction
endclass
class B extends A;
 int member2;
 rand function void printme2;
   printme1;
   $display("member2 ",member2);
 endfunction
endclass

  function void somefunc(A a_h);
    B b_h;
    void'(a_h.randomize);
    if ($cast(b_h, a_h))
       b_h.printme2;
     else
       a_h.printme1;
  endfunction
  
  A h1 = new;
  B h2 = new;
  initial begin
    somefunc(h1);
    somefunc(h2);
  end
endmodule


Here is the same example using a virtual method.

class A;
 rand int member1;
 virtual function void printme;
   $display("member1 ",member1);
 endfunction
endclass
  class B extends A;
 rand int member2;
 function void printme;
   super.printme;
   $display("member2 ",member2);
 endfunction
endclass

  function void somefunc(A a_h);
    B b_h;
    void'(a_h.randomize);
    a_h.printme;
  endfunction
  
  A h1 = new;
  B h2 = new;
  initial begin
    somefunc(h1);
    somefunc(h2);
  end
endmodule