quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Adding Members
   

space.gif

We add new variables to already defined class, or we can add new methods to already defined class

   

space.gif

   

space.gif

  ../images/main/bullet_star_pink.gif Example : Adding Members
   

space.gif


  1 program new_memeber;
  2  // Define the class
  3  class aop;
  4     integer i;
  5     function void print ();
  6       $display ("[1] Value of i %0d",i);
  7     endfunction
  8  endclass
  9  // Add new variable j and method print2 to aop class
 10  extends aop_extend (aop);
 11     integer j;
 12     function void print2 ();
 13       $display ("[2] Value of i %0d",i);
 14       $display ("[2] Value of j %0d",j);
 15     endfunction
 16  endextends
 17  // Create instance of the aop class
 18  aop a_;
 19 
 20  initial begin
 21    a_ = new ();
 22    a_.i = 10;
 23    a_.j = 11;
 24    a_.print(); 
 25    a_.print2(); 
 26  end
 27 
 28 endprogram
You could download file new_members.sv here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : Adding Members
   

space.gif

 [1] Value of i 10
 [2] Value of i 10
 [2] Value of j 11
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com