[sv-ec] Accessing parent class members

From: Kakoli Bhattacharya <kakoli_at_.....>
Date: Wed Oct 25 2006 - 01:11:39 PDT
Hello,

Consider the following example:

class A;
  int x[1:0];
  shortint y[1:0];
endclass

class B extends A;
  task init(int i);
    x[1] = i;
    y[0] = i;
  endtask
endclass

Here, is it required to access the base class variables(x,y) in the  
derived class using the 'this' keyword?

i.e. Should it be
class B extends A;
  task init(int i);
    this.x[1] = i;
    this.y[0] = i;
  endtask
endclass

As far as I know the 'this' keyword is not mandatory,but I maybe wrong.
Also as per LRM (P1800-2005) section 7.12 all the methods and class 
properties of the parent class are a part of the child class also.

Thanks,
Kakoli
Received on Wed Oct 25 01:58:24 2006

This archive was generated by hypermail 2.1.8 : Wed Oct 25 2006 - 01:58:46 PDT