Classes

what is the output of the following code and how?


class a;
  int a =10;
  function prnt();
    $display("a = %0d", a);
  endfunction
endclass

class ae extends a;
  int a =20;
endclass

module tb;
  a ah =new();
  ae aeh =new();

  initial begin
    ah.prnt();
    aeh.prnt();
  end
endmodule

In reply to Rohit_chavan:

I guess the result will be:
a = 10
a = 10

Since ae extends from a, then when you call aeh.prnt(), it uses the function from base class and it will print attributes in base class only.