This and Super operator in SV :
this is a handle to the current class object. Useful for accessing class members re-declared within a local scope super is a handle to the parent class object. Essential for accessing parent class members hidden in subclass For example, constructor Only 1 super allowed at a time. super.super.new() is illegal. The existence of a parent class can be tested for
class base;
logic b1;
protected logic c1;
function new(input logic pone);
b1 = pone;
endfunction
endclass
class sub1 extends base;
logic [1:0] b1;
local integer length;
function new(input logic pone);
super.new(pone);
this.b1 = super.b1;
endfunction
endclass
class sub2 extends sub1;
...
function new(input logic pone);
super.new(pone);
endfunction
endclass
|
|
This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start
|
Prev << Encapsulation
|
Next >> In Line Constraints
|