# \#Polymorphism

**URL:** https://verificationacademy.com/forums/tag/polymorphism/4448.md

[Latest](https://verificationacademy.com/forums/latest.md) · [Categories](https://verificationacademy.com/forums/categories.md) · [Tags](https://verificationacademy.com/forums/tags.md)

---

## [Debugging VIP's API calls](https://verificationacademy.com/forums/t/debugging-vips-api-calls/51709)

<div class="topic-metadata">

**Author:** [@bhosaleakash00](https://verificationacademy.com/forums/u/bhosaleakash00)\
**Replies:** 1\
**Last updated:** [August 3, 2026, 4:18pm UTC](https://verificationacademy.com/forums/t/debugging-vips-api-calls/51709 "2026-08-03T16:18:08Z")

</div>

Hi Forum, As a newbie I was trying following code on edaplayground Class send\_txn1 inherits non-virtual function activate and overrides virtual function do\_activate (1) Why does the overridden task do\_activate get cal…

---

## [Vending Machine in System Verilog](https://verificationacademy.com/forums/t/vending-machine-in-system-verilog/50763)

<div class="topic-metadata">

**Author:** [@CharchicaA](https://verificationacademy.com/forums/u/CharchicaA)\
**Replies:** 2\
**Last updated:** [February 2, 2026, 2:23pm UTC](https://verificationacademy.com/forums/t/vending-machine-in-system-verilog/50763 "2026-02-02T14:23:16Z")

</div>

Model a Vending Machine using OOP concepts like Inheritance and Polymorphism The vending machine can contain multiple Items Items have 2 properties: id and price Id and price could be arbitrary, they do not indicate i…

---

## [Overriding Class properties](https://verificationacademy.com/forums/t/overriding-class-properties/51360)

<div class="topic-metadata">

**Author:** [@Praveen\_Kakodra](https://verificationacademy.com/forums/u/Praveen_Kakodra)\
**Replies:** 6\
**Last updated:** [September 18, 2025, 5:19pm UTC](https://verificationacademy.com/forums/t/overriding-class-properties/51360 "2025-09-18T17:19:11Z")

</div>

Hi All, Consider the following code :: class base; int a = 10; virtual function void A(); $display("a is %0d",a); endfunction endclass class ext extends base; int a = 20; \`ifdef OVER …

---

## [Regarding Method Overriding / Polymorphism SystemVerilog](https://verificationacademy.com/forums/t/regarding-method-overriding-polymorphism-systemverilog/29191)

<div class="topic-metadata">

**Author:** [@Anand\_Kumar\_C.R](https://verificationacademy.com/forums/u/Anand_Kumar_C.R)\
**Replies:** 26\
**Last updated:** [August 15, 2025, 3:29pm UTC](https://verificationacademy.com/forums/t/regarding-method-overriding-polymorphism-systemverilog/29191 "2025-08-15T15:29:13Z")

</div>

Hi,s I was trying to override a method in SystemVerilog. However I learnt that SystemVerilog does not support C++ style function overloading. Then I resorted to polymorphism where I redefined the method with fewer argum…

---

## [Overriding non-virtual task](https://verificationacademy.com/forums/t/overriding-non-virtual-task/49793)

<div class="topic-metadata">

**Author:** [@arshi582](https://verificationacademy.com/forums/u/arshi582)\
**Replies:** 3\
**Last updated:** [March 8, 2025, 1:40am UTC](https://verificationacademy.com/forums/t/overriding-non-virtual-task/49793 "2025-03-08T01:40:04Z")

</div>

Hello Forum, I am trying to override one of the non-virtual tasks defined in base class to implement some additional logic. Here is my attempt edaplayground I have a few questions (1) Without any +define I observe the…

---

## [Signal written by more than one continuous statement](https://verificationacademy.com/forums/t/signal-written-by-more-than-one-continuous-statement/35772)

<div class="topic-metadata">

**Author:** [@arquer](https://verificationacademy.com/forums/u/arquer)\
**Replies:** 4\
**Last updated:** [October 24, 2024, 2:44pm UTC](https://verificationacademy.com/forums/t/signal-written-by-more-than-one-continuous-statement/35772 "2024-10-24T14:44:48Z")

</div>

Hello, I am in the process of porting a simulation from Vivado’s simulator (XSim if I am correct) to QuestaSim. I am using Vivado 2017.2 and QuestaSim 10.5C. The design uses SystemVerilog interfaces heavily, and the s…

---

## [Local constructor](https://verificationacademy.com/forums/t/local-constructor/41563)

<div class="topic-metadata">

**Author:** [@dyno](https://verificationacademy.com/forums/u/dyno)\
**Replies:** 1\
**Last updated:** [April 23, 2023, 4:27am UTC](https://verificationacademy.com/forums/t/local-constructor/41563 "2023-04-23T04:27:47Z")

</div>

If i Declare class constructor as local in parent class and create a child class by extending it ,is it work ?? if yes then how?? because by convectional method it gives error , is it another way to do it please share… …

---

## [Getting class derivatives names from factory](https://verificationacademy.com/forums/t/getting-class-derivatives-names-from-factory/41149)

<div class="topic-metadata">

**Author:** [@nimrodw](https://verificationacademy.com/forums/u/nimrodw)\
**Replies:** 3\
**Last updated:** [January 8, 2023, 2:34am UTC](https://verificationacademy.com/forums/t/getting-class-derivatives-names-from-factory/41149 "2023-01-08T02:34:33Z")

</div>

Hi, Given a base class that has multiple derivatives, is there a way to receive those children types (as strings for example) through the base class or some partial name match via the factory? I’ll give a concrete exam…

---

## [Systemverilog inheritance, how to call multi level up function](https://verificationacademy.com/forums/t/systemverilog-inheritance-how-to-call-multi-level-up-function/39771)

<div class="topic-metadata">

**Author:** [@aaaaaa](https://verificationacademy.com/forums/u/aaaaaa)\
**Replies:** 2\
**Last updated:** [November 8, 2021, 10:56am UTC](https://verificationacademy.com/forums/t/systemverilog-inheritance-how-to-call-multi-level-up-function/39771 "2021-11-08T10:56:40Z")

</div>

I have a test have hierarchy like this: class test\_A; virtual function drive(); endclass class test\_B extends test\_A; virtual function drive(); super.drive(); ... endfunction endclass class t…

---

## [Inheritance and Polymorphism](https://verificationacademy.com/forums/t/inheritance-and-polymorphism/39482)

<div class="topic-metadata">

**Author:** [@MarshallX](https://verificationacademy.com/forums/u/MarshallX)\
**Replies:** 3\
**Last updated:** [September 4, 2021, 9:20am UTC](https://verificationacademy.com/forums/t/inheritance-and-polymorphism/39482 "2021-09-04T09:20:03Z")

</div>

class base; task A; $display("A called"); B(); endtask virtual task B; $display("B Called"); endtask endclass class child extends base; task B; $display("B EXT called"); endtask task s…

---

## [Query on polymorphism](https://verificationacademy.com/forums/t/query-on-polymorphism/39009)

<div class="topic-metadata">

**Author:** [@naveensv](https://verificationacademy.com/forums/u/naveensv)\
**Replies:** 1\
**Last updated:** [April 23, 2021, 2:31am UTC](https://verificationacademy.com/forums/t/query-on-polymorphism/39009 "2021-04-23T02:31:46Z")

</div>

module tb; class base; virtual function void base\_f; $display("base\_f from Base Class"); base\_f2; endfunction function void base\_f2; $display("base\_f2 from Base Class"); endfunction endclass class extension e…

---

## [Difference between set type override function override and virtual function](https://verificationacademy.com/forums/t/difference-between-set-type-override-function-override-and-virtual-function/38163)

<div class="topic-metadata">

**Author:** [@theketi](https://verificationacademy.com/forums/u/theketi)\
**Replies:** 0\
**Last updated:** [October 3, 2020, 7:53pm UTC](https://verificationacademy.com/forums/t/difference-between-set-type-override-function-override-and-virtual-function/38163 "2020-10-03T19:53:34Z")

</div>

HI i am confused about usage of virtual functions normally and when we want to use set type override the class. simplified example: class A function func\_A endfunction endclass class B extends A function func A …

---

## [Individual tests extending from base test](https://verificationacademy.com/forums/t/individual-tests-extending-from-base-test/36811)

<div class="topic-metadata">

**Author:** [@dvuvmsv](https://verificationacademy.com/forums/u/dvuvmsv)\
**Replies:** 5\
**Last updated:** [November 17, 2019, 4:26pm UTC](https://verificationacademy.com/forums/t/individual-tests-extending-from-base-test/36811 "2019-11-17T16:26:29Z")

</div>

Hello, I have a basic question in all other tests ( apb\_test\_1, apb\_test\_2, apb\_test\_3 ) extending from apb\_base\_test. I have separate sequences for each test apb\_test\_1 has apb\_sequence\_1 which need to be run in …

---

## [Interface class polymorphism](https://verificationacademy.com/forums/t/interface-class-polymorphism/35546)

<div class="topic-metadata">

**Author:** [@shimonc](https://verificationacademy.com/forums/u/shimonc)\
**Replies:** 2\
**Last updated:** [December 31, 2018, 5:02pm UTC](https://verificationacademy.com/forums/t/interface-class-polymorphism/35546 "2018-12-31T17:02:32Z")

</div>

Hi SystemVerilog forum. I am trying to use polymorphism to make the code easier. The following code works but I don’t want to use it interface class inter; pure virtual function void print(); endclass: inter clas…

---

## [Bases and derived class in the context of parameterized classes](https://verificationacademy.com/forums/t/bases-and-derived-class-in-the-context-of-parameterized-classes/35211)

<div class="topic-metadata">

**Author:** [@verif\_learner1](https://verificationacademy.com/forums/u/verif_learner1)\
**Replies:** 1\
**Last updated:** [October 20, 2018, 4:07am UTC](https://verificationacademy.com/forums/t/bases-and-derived-class-in-the-context-of-parameterized-classes/35211 "2018-10-20T04:07:25Z")

</div>

This is more of a theory question. I will probably try to code an example once I get some idea. Assume I have a base class that is not parameterized. Let us call this class B. If I derive from the base class and add a …

---

## [Polymorphism](https://verificationacademy.com/forums/t/polymorphism/35067)

<div class="topic-metadata">

**Author:** [@verif\_learner1](https://verificationacademy.com/forums/u/verif_learner1)\
**Replies:** 14\
**Last updated:** [September 29, 2018, 3:03pm UTC](https://verificationacademy.com/forums/t/polymorphism/35067 "2018-09-29T15:03:04Z")

</div>

I have written a simple example to understand polymorphism better. module poly\_case4; class BaseC; virtual function void func1; $display ("func1 in BaseC"); func2; endfunction function void func2; $…

---

## [Virtual function and polymorphism](https://verificationacademy.com/forums/t/virtual-function-and-polymorphism/35055)

<div class="topic-metadata">

**Author:** [@verif\_learner1](https://verificationacademy.com/forums/u/verif_learner1)\
**Replies:** 2\
**Last updated:** [September 20, 2018, 4:10pm UTC](https://verificationacademy.com/forums/t/virtual-function-and-polymorphism/35055 "2018-09-20T16:10:50Z")

</div>

I am creating a base class in my testbench. The base class contains a bunch of functions to utility function processing. For of the function I know for sure have to be overridden in the derived classes. I have made th…

---

## [Polymorphism](https://verificationacademy.com/forums/t/polymorphism/34886)

<div class="topic-metadata">

**Author:** [@Mahesh\_6](https://verificationacademy.com/forums/u/Mahesh_6)\
**Replies:** 5\
**Last updated:** [August 21, 2018, 3:25am UTC](https://verificationacademy.com/forums/t/polymorphism/34886 "2018-08-21T03:25:39Z")

</div>

Hi All, I am trying to execute the code to understand polymorphism in SV, but not receiving the expected output; class c1; virtual function void f1 (); $display("ADD\_FUNCTION"); endfunction endclass class c2…

---

## [Compile-time Polymorphism in SV](https://verificationacademy.com/forums/t/compile-time-polymorphism-in-sv/34711)

<div class="topic-metadata">

**Author:** [@run2prem](https://verificationacademy.com/forums/u/run2prem)\
**Replies:** 4\
**Last updated:** [July 25, 2018, 9:00am UTC](https://verificationacademy.com/forums/t/compile-time-polymorphism-in-sv/34711 "2018-07-25T09:00:34Z")

</div>

I understand SV doesn’t support compile-time polymorphism i.e. function overloading evidently. Look at the example below and please help me understand two queries Is this not a candidate of ‘function overloading’ as …

---

## [How to choose a testcase class from command line on SV](https://verificationacademy.com/forums/t/how-to-choose-a-testcase-class-from-command-line-on-sv/31887)

<div class="topic-metadata">

**Author:** [@vadivelan014](https://verificationacademy.com/forums/u/vadivelan014)\
**Replies:** 2\
**Last updated:** [June 2, 2016, 5:37pm UTC](https://verificationacademy.com/forums/t/how-to-choose-a-testcase-class-from-command-line-on-sv/31887 "2016-06-02T17:37:00Z")

</div>

Hi, I am having testcase classes as one base and 2 derived classes. How can i choose a particular test from command line in native SystemVerilog. i.e. I am trying to achieve it by Polymorphism. But I do not know how to …

---

## [Task overriding in a sub class](https://verificationacademy.com/forums/t/task-overriding-in-a-sub-class/31808)

<div class="topic-metadata">

**Author:** [@theketi](https://verificationacademy.com/forums/u/theketi)\
**Replies:** 4\
**Last updated:** [May 17, 2016, 10:42pm UTC](https://verificationacademy.com/forums/t/task-overriding-in-a-sub-class/31808 "2016-05-17T22:42:45Z")

</div>

Hi I am trying to overwrite a task in the subclass (these are sequences) and when executing it , iam seeing that the original task in base class is only getting executed and not the new overridden task class baseclass;…

---

## [Why results differs w/ and w/o declaring virtual methods in extended class](https://verificationacademy.com/forums/t/why-results-differs-w-and-w-o-declaring-virtual-methods-in-extended-class/31327)

<div class="topic-metadata">

**Author:** [@tsb\_matumoto](https://verificationacademy.com/forums/u/tsb_matumoto)\
**Replies:** 2\
**Last updated:** [December 18, 2015, 5:08am UTC](https://verificationacademy.com/forums/t/why-results-differs-w-and-w-o-declaring-virtual-methods-in-extended-class/31327 "2015-12-18T05:08:31Z")

</div>

I cannot quite understand why these two cases yield different results: In extended class, virtual method is defined In extended class, virtual method is NOT defined. In detail, the situation and source code is shown b…

---

## [How do variable of base class type access property of derived class](https://verificationacademy.com/forums/t/how-do-variable-of-base-class-type-access-property-of-derived-class/31281)

<div class="topic-metadata">

**Author:** [@JDS1](https://verificationacademy.com/forums/u/JDS1)\
**Replies:** 1\
**Last updated:** [December 3, 2015, 12:52pm UTC](https://verificationacademy.com/forums/t/how-do-variable-of-base-class-type-access-property-of-derived-class/31281 "2015-12-03T12:52:34Z")

</div>

Here I have tried to mimic clone method of uvm\_object. typedef base\_class; typedef derived\_class; function base\_class create(); derived\_class tmp; tmp = new(); return tmp; endfunction class base\_class; virtual f…

---

## [Can derived class object call base class (virtual/non-virtual) function?](https://verificationacademy.com/forums/t/can-derived-class-object-call-base-class-virtual-non-virtual-function/31043)

<div class="topic-metadata">

**Author:** [@Vignesh\_Raghavan](https://verificationacademy.com/forums/u/Vignesh_Raghavan)\
**Replies:** 3\
**Last updated:** [September 22, 2015, 4:54pm UTC](https://verificationacademy.com/forums/t/can-derived-class-object-call-base-class-virtual-non-virtual-function/31043 "2015-09-22T16:54:52Z")

</div>

Hello, I need a clarification regarding Inheritance and Polymorphism. class A; function void display(); ... endfunction : display endclass : A class B extends A; function void display(); ... endfuncti…
