Hi,
Though I don't have the access to draft LRM, but by reading the SV
mails, I came to know SV 2009 is going to support something called pure
virtual function inside class similar to C++ (i.e. there will no body
for the virtual function which is declared with 'pure' keyword). And
also there is a LRM snippet :
In general, if an abstract class has any
virtual methods, all
of the methods must be overridden (and provided with a method body) for
the
subclass to be instantiated. If any virtual methods have no
implementation, the subclass needs to be
abstract.
So if we go by LRM, then any subclasses which
does not have any body for the pure virtual function present in the
base class, then that sub class too will be considered as abstract,
i.e. this is also not allowed to be instantiated.
Now, except one standard simulator, none yet support pure virtual
function. And if we consider the following case:
virtual class base;
pure virtual function int f();
endclass
class derived extends base;
endclass
That simulator fails saying that the pure virtual function is not
defined inside 'derived' class. I think this is an incorrect behaviour,
as SV LRM as well as C++ LRM does not mention to give error, they mean
just the class 'derived' then becomes abstract (can not be
instantiated). And if we derive another class from this subclass where
the body of the pure virtual function is there, then it should be fine.
So the simulator must have a bug. Please can anyone comment on that.
--
Regards
Surya
--
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.
Received on Tue Oct 7 00:52:20 2008