Home System Verilog SV Classes this and super
Main Menu
Home
System Verilog
    - Constructs
    - SV Classes
        -- Simple Class
        -- Inheritance
        -- Encapsulation
        -- this and super
        -- In Line Constraints
        -- Class Constraints
        -- Virtual Classes
        -- Parameterized Classes
        -- Summary
        -- Singleton Class
    - Functional Coverage SV
    - Examples
    - Tools
    - Links
    - Books
    - Interview Questions SV
Verilog
Methodologies
Open Vera
Digital Concepts
Verification Basics
Protocols
Scripting
Articles
Videos
Interview Questions
Computer Architechture
C and C++
Blog/Article
AsicGuru Blog
Tags Cloud
Ads
Usefull Sites
Know Your IP/Location
Local Information India
Buy Car/Inverter Batteries
Real Estate India
Sports Accessories India
this and super in sv
Share This Articale:

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

 
Login/Register
Register
Sign In
Login with :-
gmail-yahoo-twitter-facebook
| | |  
  •  
  • Bookmark
    ADS