Subject: [sv-ec] Question On Class Methods
From: Baleme, Paul (paul.baleme@intel.com)
Date: Fri Feb 20 2004 - 17:25:20 PST
Reading 3.1 draft 4, sections 10 and 11, it is unclear whether the
method signature is used to differentiate method calls. For example:
Assume PacketA and PacketB are subclasses of Packet
Could I write two versions of sendPacket? One for each type of packet I
want to send?
class MyBFM;
function sendPacket(PacketTypeA p);
/* do type A packet */
endfunction
function sendPacket(PacketTypeB p);
/* do type B packet */
endfunction
endclass
Or do I have to write a single version of sendPacket that figures out
what type of packet it is and calls another send routine?
class MyBFM;
function sendPacket(Packet p);
if (p.isTypeA()) sendPacketA(p);
if (p.isTypeB()) sendPacketB(p);
endfunction
endclass
I get the impression (especially reading 10.4.3) that I would have to
do the second solution.
-paul
This archive was generated by hypermail 2b28 : Fri Feb 20 2004 - 17:32:52 PST