Xref: utzoo comp.object:2459 comp.lang.c++:11365 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!swrinde!ucsd!dog.ee.lbl.gov!pasteur!galileo.berkeley.edu!jbuck From: jbuck@galileo.berkeley.edu (Joe Buck) Newsgroups: comp.object,comp.lang.c++ Subject: Re: Inheritance and Information Hiding Message-ID: <10609@pasteur.Berkeley.EDU> Date: 30 Jan 91 18:31:19 GMT References: <1991Jan23.224203.3206@runx.oz.au> <1991Jan24.214652.18515@Think.COM> <27A44871.5586@tct.uucp> <1991Jan29.221121.20642@odin.corp.sgi.com> Sender: news@pasteur.Berkeley.EDU Reply-To: jbuck@galileo.berkeley.edu (Joe Buck) Lines: 14 In article <1991Jan29.221121.20642@odin.corp.sgi.com>, linton@sgi.com (Mark Linton) writes: > As for virtual functions, if you can't live with cost of a virtual function call > you are unlikely to be happy with the cost of a direct function call. A virtual > function call typically adds a few memory references on top of what is likely > a considerably more expensive operation, involving register save/restore and > a branch. The choice isn't always between the overhead of a virtual function call and a direct function call -- you forgot about "inline". In most cases virtual functions can't be inlined (except in cases where the compiler knows the exact class). -- Joe Buck jbuck@galileo.berkeley.edu {uunet,ucbvax}!galileo.berkeley.edu!jbuck