Kakoli Bhattacharya wrote: > 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 This is legal. > 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 This is also legal but the "this" prefix is not required. > 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. Right. Inherited members are directly visible in derived classes. Gord -- -------------------------------------------------------------------- Gordon Vreugdenhil 503-685-0808 Model Technology (Mentor Graphics) gordonv@model.comReceived on Wed Oct 25 06:49:53 2006
This archive was generated by hypermail 2.1.8 : Wed Oct 25 2006 - 06:50:13 PDT