|
What is the use of the abstract class?
|
|
What is the use of the abstract class?
A virtual class is a temple or place holder for the child classes. A virtual class is also called as the abstract class. A virtual class is declared with a virtual keyword like :
virtual class base;
endclass;
A virtual class instance or object can not be constucted but you can define the hadle to the virtual class.
A virtual class is a temple or place holder for the child classes. A virtual class is also called as the abstract class. A virtual class is declared with a virtual keyword like :
virtual class base;
virtual task1;
endtask;
virtual task2;
endtask;
endclass;
A virtual class instance or object can not be constucted but you can define the hadle to the virtual class.
virtual class baseframe;
...
virtual function void iam();
endfunction
...
endclass
class shortframe extends baseframe;
...
function void iam();
$display ("Short Frame");
endfunction
endclass
class longframe extends baseframe;
...
function void iam();
$display ("Long Frame");
endfunction
endclass
baseframe two; // OK
initial begin
two = new(4); // ERROR
...
Find more about it here : http://www.asicguru.com/system-verilog/sv-classes/virtual-classes/96/
|
|
This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start
|
Prev << Need of virtual interface
|
Next >> Part 1
|