Verification Guild
A Community of Verification Professionals

 Create an AccountHome | Calendar | Downloads | FAQ | Links | Site Admin | Your Account  

Login
Nickname

Password

Security Code: Security Code
Type Security Code
BACKWARD

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Modules
· Home
· Downloads
· FAQ
· Feedback
· Recommend Us
· Web Links
· Your Account

Advertising

Who's Online
There are currently, 55 guest(s) and 1 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

  
Verification Guild: Forums

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile  ProfileDigest    Log inLog in 

Class Vs Abstract Class??
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Verification Guild Forum Index -> Main
View previous topic :: View next topic  
Author Message
dave_59
Senior
Senior


Joined: Jun 22, 2004
Posts: 974
Location: Fremont, CA

PostPosted: Wed Jan 04, 2012 12:41 pm    Post subject: Reply with quote

nimesh,

Calling a virtual method from a constructor is a dangerous thing to do. Initialization of class members starts at the base class and moves down the extended hierarchy. But if the initialization of a base class member calls a virtual method, the extended class members have not been initialized yet. See http://www.eda.org/svdb/view.php?id=2488

They should be illegal, but I think it would be difficult for a compiler to check if there are nested method calls except at run time, which would be very expensive.

Using the OVM/UVM, there is very little you put in the constructor. A separate build() method is used to perform most of the actual construction and avoids this problem.
Back to top
View user's profile Send e-mail Visit poster's website
nimesh
Newbie
Newbie


Joined: Jan 03, 2012
Posts: 2

PostPosted: Thu Jan 05, 2012 12:29 am    Post subject: Reply with quote

Hi Dave,

I really appreciate your response.

I also had the same understanding but whole upper thread of Mr. Amer Sultan and BugCatcher points to unexpected output of calling virtual method from constructor. That confused me about execution flow. I put the simulation result here for clarification of calling virtual methods from constructor. It will call its own method not the derived class. This will help other user to understand flow better J!.

Regards,
-Nimesh
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Verification Guild Forum Index -> Main All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Verification Guild © 2006 Janick Bergeron
Web site engine's code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.273 Seconds