# \#Inheritance

**URL:** https://verificationacademy.com/forums/tag/inheritance/4871.md

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

---

## [Best Practice for Unit Tests Extending Chip-Level Tests](https://verificationacademy.com/forums/t/best-practice-for-unit-tests-extending-chip-level-tests/46711)

<div class="topic-metadata">

**Author:** [@nick\_411](https://verificationacademy.com/forums/u/nick_411)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 4:50pm UTC](https://verificationacademy.com/forums/t/best-practice-for-unit-tests-extending-chip-level-tests/46711 "2024-04-06T16:50:48Z")

</div>

Hello, I have a chip-level test with the structure of a base\_test and all specific test cases extend from base\_test. The environment consists of an I2C UVC and a register model with backdoor access. I want to create a u…

---

## [Extending parameterized classes](https://verificationacademy.com/forums/t/extending-parameterized-classes/44710)

<div class="topic-metadata">

**Author:** [@kpdeepak](https://verificationacademy.com/forums/u/kpdeepak)\
**Replies:** 4\
**Last updated:** [January 5, 2024, 5:17pm UTC](https://verificationacademy.com/forums/t/extending-parameterized-classes/44710 "2024-01-05T17:17:43Z")

</div>

Hi All, In the following example, class Trans #(int awidth=8, dwidth=8); string name; function new(string name = ""); this.name = name; endfunction virtual function void display(); $disp…

---

## [Systemverilog inheritance question](https://verificationacademy.com/forums/t/systemverilog-inheritance-question/41203)

<div class="topic-metadata">

**Author:** [@zz8318](https://verificationacademy.com/forums/u/zz8318)\
**Replies:** 4\
**Last updated:** [January 24, 2023, 5:13pm UTC](https://verificationacademy.com/forums/t/systemverilog-inheritance-question/41203 "2023-01-24T17:13:48Z")

</div>

I have below code with some parent/child class definition (all of them are sequences) class A; my\_ral\_block my\_block; task pre\_start(); uvm\_config\_db#(my\_ral\_block)::get(null, "\*", "my\_ral\_block", my\_block); …

---

## [Can we use factory type override for a sub-class that has extra methods?](https://verificationacademy.com/forums/t/can-we-use-factory-type-override-for-a-sub-class-that-has-extra-methods/41173)

<div class="topic-metadata">

**Author:** [@Sungmin\_Hong](https://verificationacademy.com/forums/u/Sungmin_Hong)\
**Replies:** 2\
**Last updated:** [January 14, 2023, 9:58am UTC](https://verificationacademy.com/forums/t/can-we-use-factory-type-override-for-a-sub-class-that-has-extra-methods/41173 "2023-01-14T09:58:47Z")

</div>

Hi, I got an compile error during elaboration, when I’ve tried to override subclass type that has extra methods. Is there any way that I can use factory for the situation or better way? (Adding every extra methods of s…

---

## [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…

---

## [Question related to inheritance and classes](https://verificationacademy.com/forums/t/question-related-to-inheritance-and-classes/40827)

<div class="topic-metadata">

**Author:** [@shubh2211](https://verificationacademy.com/forums/u/shubh2211)\
**Replies:** 10\
**Last updated:** [October 15, 2022, 5:20pm UTC](https://verificationacademy.com/forums/t/question-related-to-inheritance-and-classes/40827 "2022-10-15T17:20:44Z")

</div>

So, we have three classes (class base\_1, base\_2, base\_3 respectively) and these three classes have their three extended classes(class ext\_1,ext\_2,ext\_3 respectively) Now the three extended classes have their handles c1,…

---

## [Member variable to be only inherited by immediate child](https://verificationacademy.com/forums/t/member-variable-to-be-only-inherited-by-immediate-child/39256)

<div class="topic-metadata">

**Author:** [@bhupeshpaliwal](https://verificationacademy.com/forums/u/bhupeshpaliwal)\
**Replies:** 8\
**Last updated:** [July 5, 2021, 2:52pm UTC](https://verificationacademy.com/forums/t/member-variable-to-be-only-inherited-by-immediate-child/39256 "2021-07-05T14:52:48Z")

</div>

Is this possible to make parent class member variable to be visible ONLY to immediate child and not further in inheritance hierarchy? virtual class parent; string s; // .. endclass class child extends parent; //…

---

## [Super.Super() call alternative system verlilog](https://verificationacademy.com/forums/t/super-super-call-alternative-system-verlilog/39244)

<div class="topic-metadata">

**Author:** [@Abhishek405](https://verificationacademy.com/forums/u/Abhishek405)\
**Replies:** 1\
**Last updated:** [June 29, 2021, 11:44pm UTC](https://verificationacademy.com/forums/t/super-super-call-alternative-system-verlilog/39244 "2021-06-29T23:44:12Z")

</div>

I’ve a scenario like this: Let’s say there is a base class: class A - which has a virtual function: get\_data(); Then class B extended from Class A. It overrides the function get\_data() and calls super.get\_data() insid…

---

## [Base and Derived Class Randomization](https://verificationacademy.com/forums/t/base-and-derived-class-randomization/38670)

<div class="topic-metadata">

**Author:** [@prasham98](https://verificationacademy.com/forums/u/prasham98)\
**Replies:** 5\
**Last updated:** [February 14, 2021, 6:40pm UTC](https://verificationacademy.com/forums/t/base-and-derived-class-randomization/38670 "2021-02-14T18:40:21Z")

</div>

class b; rand int a; rand int b; endclass class d extends b; constraint c3 {a == 35;} constraint c4 {b == 20;} endclass module top; initial begin b b1; d d1; b1 = new(); d1 = new(…

---

## [Base class override in UVM testbench](https://verificationacademy.com/forums/t/base-class-override-in-uvm-testbench/38459)

<div class="topic-metadata">

**Author:** [@sv\_uvm\_49](https://verificationacademy.com/forums/u/sv_uvm_49)\
**Replies:** 5\
**Last updated:** [December 14, 2020, 6:40am UTC](https://verificationacademy.com/forums/t/base-class-override-in-uvm-testbench/38459 "2020-12-14T06:40:00Z")

</div>

Hi all, I have a testbench with the following testcase heirarchy: class base\_test extends uvm\_test; … endclass class test\_A extends base\_test; … endclass class test\_1 extends test\_A; … endclass class test\_2 exten…

---

## [Why base class can't be assigned to derived class?](https://verificationacademy.com/forums/t/why-base-class-cant-be-assigned-to-derived-class/38150)

<div class="topic-metadata">

**Author:** [@mohansrikanthsunkara](https://verificationacademy.com/forums/u/mohansrikanthsunkara)\
**Replies:** 5\
**Last updated:** [October 3, 2020, 12:40am UTC](https://verificationacademy.com/forums/t/why-base-class-cant-be-assigned-to-derived-class/38150 "2020-10-03T00:40:14Z")

</div>

Hi, Why base class can’t be assigned to derived class? class A; bit var1; endclass class B extends A; //No Variables defined endclass module top; A a =new(); B b =new(); initial b = a; // Compilation e…

---

## [Inheritance/ Same variable declared in derived class as parent class](https://verificationacademy.com/forums/t/inheritance-same-variable-declared-in-derived-class-as-parent-class/38022)

<div class="topic-metadata">

**Author:** [@ssakshi](https://verificationacademy.com/forums/u/ssakshi)\
**Replies:** 1\
**Last updated:** [September 3, 2020, 6:47am UTC](https://verificationacademy.com/forums/t/inheritance-same-variable-declared-in-derived-class-as-parent-class/38022 "2020-09-03T06:47:11Z")

</div>

Hi, I have a doubt in the following implementation: class parent\_class; bit \[31:0\] addr; bit \[31:0\] data; function new(); addr= 'hffff; data = 'h5555; endfunction task display(); $display("Base…

---

## [What is the difference between a base class and a parent class in UVM](https://verificationacademy.com/forums/t/what-is-the-difference-between-a-base-class-and-a-parent-class-in-uvm/37614)

<div class="topic-metadata">

**Author:** [@mariam\_triki](https://verificationacademy.com/forums/u/mariam_triki)\
**Replies:** 4\
**Last updated:** [May 26, 2020, 4:26pm UTC](https://verificationacademy.com/forums/t/what-is-the-difference-between-a-base-class-and-a-parent-class-in-uvm/37614 "2020-05-26T16:26:44Z")

</div>

Hi I got confused btw base and parent class. I thought it was the same thing however I read in some forums that they have different meaning

---

## [What is the difference between Super and Virtual keywords when accessing methods in a Base Class?](https://verificationacademy.com/forums/t/what-is-the-difference-between-super-and-virtual-keywords-when-accessing-methods-in-a-base-class/37378)

<div class="topic-metadata">

**Author:** [@GeorgeOnwubuya](https://verificationacademy.com/forums/u/GeorgeOnwubuya)\
**Replies:** 1\
**Last updated:** [March 31, 2020, 9:34pm UTC](https://verificationacademy.com/forums/t/what-is-the-difference-between-super-and-virtual-keywords-when-accessing-methods-in-a-base-class/37378 "2020-03-31T21:34:12Z")

</div>

Are there any advantages or disadvantages to using the ‘virtual’ keyword over the ‘super’ keyword when accessing methods in a base class? I understand that both can be used to override the method in a base class but it …

---

## [Inheritance example](https://verificationacademy.com/forums/t/inheritance-example/37223)

<div class="topic-metadata">

**Author:** [@avpchandra](https://verificationacademy.com/forums/u/avpchandra)\
**Replies:** 1\
**Last updated:** [February 21, 2020, 7:30pm UTC](https://verificationacademy.com/forums/t/inheritance-example/37223 "2020-02-21T19:30:59Z")

</div>

Hi I want to understand the output of the below source code. module abc(); class A; int i; function new(int i = 10); this.i = i; $display("This is from Parent class"); endfunction endcla…

---

## [What is multiple and multi-layer inheritance in system verilog](https://verificationacademy.com/forums/t/what-is-multiple-and-multi-layer-inheritance-in-system-verilog/36933)

<div class="topic-metadata">

**Author:** [@m\_r\_m](https://verificationacademy.com/forums/u/m_r_m)\
**Replies:** 1\
**Last updated:** [December 17, 2019, 10:57am UTC](https://verificationacademy.com/forums/t/what-is-multiple-and-multi-layer-inheritance-in-system-verilog/36933 "2019-12-17T10:57:49Z")

</div>

what is multiple and multi-layer inheritance in system verilog?? -according to SV-LRM 8.13 The mechanism provided by SystemVerilog is called single inheritance, that is, each class is derived from a single base class. …

---

## [Inheritance case](https://verificationacademy.com/forums/t/inheritance-case/35212)

<div class="topic-metadata">

**Author:** [@verif\_learner1](https://verificationacademy.com/forums/u/verif_learner1)\
**Replies:** 2\
**Last updated:** [October 21, 2018, 3:59pm UTC](https://verificationacademy.com/forums/t/inheritance-case/35212 "2018-10-21T15:59:26Z")

</div>

Please look at the following case. The base class has func1 and func2. func2 calls func2. The derived class overrides func1. An instance of derived class is created and func2 is called using derived class variable. T…

---

## [Multiple Inheritance In system verilog](https://verificationacademy.com/forums/t/multiple-inheritance-in-system-verilog/34924)

<div class="topic-metadata">

**Author:** [@learning\_uvm](https://verificationacademy.com/forums/u/learning_uvm)\
**Replies:** 2\
**Last updated:** [August 27, 2018, 5:09pm UTC](https://verificationacademy.com/forums/t/multiple-inheritance-in-system-verilog/34924 "2018-08-27T17:09:40Z")

</div>

How can we perform the concept of multiple inheritance in system verilog. ie the child class is extended by two or more parent classes.

---

## [How can I use parent class's member variable in systemverilog?](https://verificationacademy.com/forums/t/how-can-i-use-parent-classs-member-variable-in-systemverilog/34824)

<div class="topic-metadata">

**Author:** [@UVM\_LOVE](https://verificationacademy.com/forums/u/UVM_LOVE)\
**Replies:** 2\
**Last updated:** [August 8, 2018, 1:26am UTC](https://verificationacademy.com/forums/t/how-can-i-use-parent-classs-member-variable-in-systemverilog/34824 "2018-08-08T01:26:52Z")

</div>

Dear All, I’m trying to understand an overriding class member in systemverilog with the below example code, As I understand, If I want to override then do use “extend” such as class child\_class extends parent\_class. if …

---

## [Multiple inheritence in SV](https://verificationacademy.com/forums/t/multiple-inheritence-in-sv/33877)

<div class="topic-metadata">

**Author:** [@verif\_learner1](https://verificationacademy.com/forums/u/verif_learner1)\
**Replies:** 2\
**Last updated:** [January 2, 2018, 4:52pm UTC](https://verificationacademy.com/forums/t/multiple-inheritence-in-sv/33877 "2018-01-02T16:52:40Z")

</div>

I would like to know the reasoning behind not allowing multiple inheritance in SV. Sometimes, things look so un-intuitive just because multiple inheritance is not allowed. For example, in the UVM class hierarchy, uvm\_c…

---

## [Question on Inheritance in SV](https://verificationacademy.com/forums/t/question-on-inheritance-in-sv/33787)

<div class="topic-metadata">

**Author:** [@soumyarayaprolu](https://verificationacademy.com/forums/u/soumyarayaprolu)\
**Replies:** 13\
**Last updated:** [December 7, 2017, 4:42pm UTC](https://verificationacademy.com/forums/t/question-on-inheritance-in-sv/33787 "2017-12-07T16:42:20Z")

</div>

Can anyone explain why I am getting a as 0 in the below example: module top; class C; int c1 = 1; int c2 = 1; int c3 = 1; function new(int a); $display("ZAM:…

---

## [Partial override of a class](https://verificationacademy.com/forums/t/partial-override-of-a-class/33625)

<div class="topic-metadata">

**Author:** [@Peak25500](https://verificationacademy.com/forums/u/Peak25500)\
**Replies:** 4\
**Last updated:** [October 23, 2017, 8:57am UTC](https://verificationacademy.com/forums/t/partial-override-of-a-class/33625 "2017-10-23T08:57:38Z")

</div>

Hi guys, Here is my problem: I have a class BaseClass that I extend to DerivedClass. In BaseClass, I have three function that are A, B and C. Function A calls B which itself calls C. In DerivedClass I have overriden …

---

## [Class member variable re-declaration](https://verificationacademy.com/forums/t/class-member-variable-re-declaration/33288)

<div class="topic-metadata">

**Author:** [@evilpascal](https://verificationacademy.com/forums/u/evilpascal)\
**Replies:** 4\
**Last updated:** [July 12, 2017, 2:45pm UTC](https://verificationacademy.com/forums/t/class-member-variable-re-declaration/33288 "2017-07-12T14:45:02Z")

</div>

Why isn’t this re-declaration of arr array flagged as an error? Doesn’t my\_class2 already contain member variable arr? class my\_class; bit \[7:0\] arr \[10\]; endclass class my\_class2 extends my\_class; bit \[7:0\]…

---

## [Inheritance overridden member - memory allocation issue](https://verificationacademy.com/forums/t/inheritance-overridden-member-memory-allocation-issue/32424)

<div class="topic-metadata">

**Author:** [@shahkavish77](https://verificationacademy.com/forums/u/shahkavish77)\
**Replies:** 2\
**Last updated:** [October 14, 2016, 9:21pm UTC](https://verificationacademy.com/forums/t/inheritance-overridden-member-memory-allocation-issue/32424 "2016-10-14T21:21:07Z")

</div>

Hi, I want to understand memory allocation while overriding member in concept of inheritance. My code is - class a; int i = 1; endclass : a class b; int i = 2; endclass : b module top; a a1; b b1; int p1,p…

---

## [Base class handle for extended class is not working in SystemVerilog](https://verificationacademy.com/forums/t/base-class-handle-for-extended-class-is-not-working-in-systemverilog/32171)

<div class="topic-metadata">

**Author:** [@milinraijada](https://verificationacademy.com/forums/u/milinraijada)\
**Replies:** 2\
**Last updated:** [August 18, 2016, 6:06pm UTC](https://verificationacademy.com/forums/t/base-class-handle-for-extended-class-is-not-working-in-systemverilog/32171 "2016-08-18T18:06:42Z")

</div>

Hi All, I am writing following program in System Verilog class base; int a = 5; endclass class extend extends base; int b = 1; endclass module test; initial begin base m\_base; extend m\_extend; …

---

## [Difference between inheritance and polymorphism](https://verificationacademy.com/forums/t/difference-between-inheritance-and-polymorphism/32148)

<div class="topic-metadata">

**Author:** [@Debasmita](https://verificationacademy.com/forums/u/Debasmita)\
**Replies:** 4\
**Last updated:** [August 12, 2016, 4:24pm UTC](https://verificationacademy.com/forums/t/difference-between-inheritance-and-polymorphism/32148 "2016-08-12T16:24:26Z")

</div>

Hi, Can anybody help me in understanding the main difference between Inheritance and polymorphism ? Thanks Debasmita

---

## [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;…

---

## [Problem in casting and super](https://verificationacademy.com/forums/t/problem-in-casting-and-super/31809)

<div class="topic-metadata">

**Author:** [@Huzefa\_Halolwala](https://verificationacademy.com/forums/u/Huzefa_Halolwala)\
**Replies:** 1\
**Last updated:** [May 12, 2016, 6:59am UTC](https://verificationacademy.com/forums/t/problem-in-casting-and-super/31809 "2016-05-12T06:59:57Z")

</div>

This is my following code : class A ; virtual task disp (); $display(" This is class A "); endtask endclass class B extends A ; task disp (); $display(" This is Extended class A "); endtask endclass class C extends …

---

## [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…

---

## [Inheritance Vs Composition in System Verilog world](https://verificationacademy.com/forums/t/inheritance-vs-composition-in-system-verilog-world/29912)

<div class="topic-metadata">

**Author:** [@vmdbset](https://verificationacademy.com/forums/u/vmdbset)\
**Replies:** 0\
**Last updated:** [September 10, 2014, 12:15am UTC](https://verificationacademy.com/forums/t/inheritance-vs-composition-in-system-verilog-world/29912 "2014-09-10T00:15:48Z")

</div>

There is enough documentation/articles on advantages vs disadvantages of Inheritance over Composition in OOP (C++ world). I do not see papers OR articles that clearly demonstrate the advantages/disadvantages of Inheritan…

[Next page](https://verificationacademy.com/forums/tag/inheritance/4871.md?match_all_tags=true&page=1&tags%5B%5D=Inheritance)
