Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!uwvax!sevenlayer.cs.wisc.edu!bothner From: bothner@sevenlayer.cs.wisc.edu (Per Bothner) Newsgroups: comp.lang.c++ Subject: Re: Nonvirtual base classes in MI Message-ID: <1991Feb1.195420.26603@spool.cs.wisc.edu> Date: 1 Feb 91 19:54:20 GMT References: <1159@zinn.MV.COM> <1991Jan31.164927.3234@odin.corp.sgi.com> Sender: news@spool.cs.wisc.edu (The News) Reply-To: bothner@sevenlayer.cs.wisc.edu (Per Bothner) Organization: University of Wisconsin--Madison Lines: 16 In article <1991Jan31.164927.3234@odin.corp.sgi.com>, linton@sgi.com (Mark Linton) writes: >I would like to echo the original question, as I also have not encountered >a situation where I need non-virtual base classes. Perhaps it should be emphasized that even if one doesn't *need* non-virtual base classes, it may be reasonable to use them anyway for efficiency reasons. The main example is that of abstract base classes (or ones where the base class is otherwise "constant.") If one has a class hierarchy rooted in Object, it is undesirable to make Object a virtual base class, since it would add an extra indirection to *every virtual function call,* even for objects which only actually inherit from Object along a single path. -- --Per Bothner bothner@cs.wisc.edu Computer Sciences Dept, U. of Wisconsin-Madison