Skip to content

Instantly share code, notes, and snippets.

@Lotus10011001
Created February 21, 2023 14:45
// Code your testbench here
// or browse Examples
// Code your testbench here
// or browse Examples
// Code your testbench here
// or browse Examples
class animal;
int age=-1;
function new(int a /*= 20*/);
age = a;
endfunction : new
endclass : animal
class lion extends animal;
function new();
super.new();
endfunction : new
endclass : lion
module test();
animal a;
lion l;
initial begin
l = new(); // l = new() will work
$display("@@@@ age is %0d",l.age);
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment