Hello, Consider the following code: virtual class Parent; integer it; int i; virtual task virtual_task(input reg rg); //This is the declaration endtask endclass class Child1 extends Parent; shortint si; longint li; virtual task virtual_task1(input reg rg1); endtask endclass class Child2 extends Child1; real r1; shortreal sr1; time t1; realtime rt1; task virtual_task(input reg rg1); // This is the redefinition it = rg1; i = rg1; si = rg1; li = rg1; endtask enclass My problem concerns the virtual task 'virtual_task'. When it has been declared in the parent class 'Parent' then it takes 'rg' as its argument. During its redefinition in the child class 'Child2' it takes 'rg1' as its argument. *Is it necessary that the names of the variables also have to be identical?* In LRM (1800-2005) Section 7.19 it is stated that "Virtual methods provide prototypes for subroutines, i.e., all of the information generally found on the first line of a method declaration: the encapsulation criteria, the type and number of arguments, and the return type if it is needed. Later, when subclasses override virtual methods, they must follow the prototype exactly." Prototype however do not mean identical variable name.But later on in the same section it is also stated that "Thus, all versions of the virtual method look identical in all subclasses" So what does the word 'identical' exactly mean overhere? Does it imply identical argument name also? Thanks, KakoliReceived on Thu Oct 19 06:08:26 2006
This archive was generated by hypermail 2.1.8 : Thu Oct 19 2006 - 06:08:46 PDT