Hi,
Greetings
I would like to know how new() constructor function is being overridden as it is non- virtual in nature.
Thanks in advance.
Hi,
Greetings
I would like to know how new() constructor function is being overridden as it is non- virtual in nature.
Thanks in advance.
In reply to satih devrari:
You can override any method that is non-virtual. For a constructor, you just need an explicit reference to the extended class type by using an extended class variable or class type
class A;
function new;
$display("constructing A");
endfunction
endclass
class B;
function new;
super.new();
$display("constructing B");
endfunction
endclass
...
A a_h;
B b_h;
...
b_h = new;
a_h = B::new;
In reply to dave_59:
In reply to satih devrari:
class A;
function new;
$display("constructing A");
endfunction
endclass
class B;
function new;
super.new();
$display("constructing B");
endfunction
endclass
...
A a_h;
B b_h;
...
b_h = new;
a_h = B::new;
plz tell the operation of a_h = B::new;
In reply to Rajaraman R:
plz read section 8.8 Typed constructor calls in the IEEE 1800-2012 LRM
In reply to dave_59:
What is meant by overriding a non virtual method ? How can we do that?
In reply to Gouthams:
I just showed you above how a non virtual function gets overridden. Please see my course on Systemverilog OOP where I show you you can override both virtual and non-virtual methods, and use them together.
In reply to dave_59:
I think class B needs to be extended from class A.
In reply to Gouthams:
It’s not a override a non-virtual method.I am doing only a constructor calling.
Thankyou for replaying…