A
Ashish Dobhal
Guest
Can we have multiple constructors in a single class in System Verilog?
E.g.,
module test;
class A;
int i;
function new();
i=0;
endfunction
function new(input int a);
i=a;
endfunction
endclass
A a1;
initial
begin
a1=new(2);
$display("value is :%d",a1.i);
end
endmodule
E.g.,
module test;
class A;
int i;
function new();
i=0;
endfunction
function new(input int a);
i=a;
endfunction
endclass
A a1;
initial
begin
a1=new(2);
$display("value is :%d",a1.i);
end
endmodule