# Function new() with virtual keyword

**URL:** <https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, new-function, function-new\
**Created:** [February 11, 2021, 5:23am UTC](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708 "2021-02-11T05:23:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [February 11, 2021, 3:56pm UTC](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708/4 "2021-02-11T15:56:16Z")

</div>

_In reply to [bachan21](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708/3):_

> _In reply to [bl4ckp3rl](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708/3):_  
> Hi Thanks for the reply.  
> Why do we avoid mentioning void return type to new() constructor

Because it would be redundant.

This is patterned after other OOP languages like C++ and Java. The return type of the constructor can only be one type, the type of the class it is declared within. If you had to declare the return type, people might think you had a choice, which you don’t. Since new is a keyword, not a regular identifier, we can put this into the syntax.

---

_[View the full topic](https://verificationacademy.com/forums/t/function-new-with-virtual-keyword/38708)._
