[sv-ec] abstract classes - doubts

From: danielm <danielm_at_.....>
Date: Wed Apr 09 2008 - 07:42:16 PDT
The description of abstact classes in 1800-2005 reminds lot not covered
behatiours. Maybe this is covered by 1800-2008 D4? There is a list of my
questions driven by typical object oriented code practices:
 
1st. Do all virtual methods in virtual class have to have no body :
virtual class C; 
    virtual task t1; endtask //method with no body
    virtual task t; $display("C::t"); endtask //is this allowed ????
endclass
 
2nd. How to define virtual method in virtual class which should do nothing
but should not to be abstract and should not be overriden?
virtual class C; 
    virtual task t1; endtask 
endclass
class D extends C;
endclass
D d=new;
initial  d.t1; //this task just should do nothing if it is not overriden  -
there is obligation to override it to get non-abstact method
 
3rd Should all virtual methods from virtual class be considered as abstract
and have to be ovveridden in child classes - nevermind if they have body or
not.
virtual class C; 
    virtual task t1; endtask //is it abstract
    virtual task t; $display("C::t"); endtask //is it abstract
endclass
 
4th  Can I have both abstract and not abstract methods in virtual class?
 virtual class C;  
    virtual task t1; endtask //this is abstract need to be overriden
    virtual task t; $display("C::t"); endtask //this is non abstract - no
need for overrride
endclass
 
5th  Can I have both abstract and not abstract methods in nonvirtual class?
class C; 
    virtual task t1; endtask //this is abstract need to be overriden
    virtual task t; $display("C::t"); endtask //this is non abstract - no
need for overrride
endclass
 
6th - The idea of "virtual class" is quite distant for what in fact abstract
classes are. Abstract classes - are classes with at least single method
which has no implementation (pure virtual methods) - so woudln't it be
better to have special syntax for defining pure virtual methods that virtual
classses ie:
    pure virtual function f; endfunction
or 
    virtual function f=0; endfunction
 
 
Current description is quite misterious and lots of information is written
between the lines - implicitly.
 
DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Apr 9 07:42:53 2008

This archive was generated by hypermail 2.1.8 : Wed Apr 09 2008 - 07:43:02 PDT